14-系统优化

vim /etc/ssh/sshd_config:密钥配置文件

ssh-keygen:生成密钥对(一路回车;或者给私钥设置密码加强安全性)

ssh-copy-id -i root@2.2.2.3(服务端ip地址):向服务端发送密钥  cat /root/.ssh/authorized_keys:查看传输的密钥

ssh root@2.2.2.3:连接服务端

 

ulimit -u:查看最大打开的进程数目

ulimit -n:查看最大打开的文件数目

 

加大文件描述符与最大打开的进程数:
cat >>/etc/security/limits.conf<<EOF

* soft nofile 102400

* hard nofile 102400

* soft nproc 102400

* hard nproc 102400

EOF

 

vim /etc/security/limits.d/20-nproc.conf:配置用户开启最大进程数文件

echo "vm.swappiness=10" | tee -a /etc/sysctl.conf:swappiness的设置

sysctl -p:永久生效

 

echo "kernel.pid_max=4194303" | tee -a /etc/sysctl.conf:设置最大pid个数

sysctl -p:永久生效

 

 

小练习:

import time
import os

print(os.getpid())

with open('a.txt',mode='wt') as f1,open('b.txt',mode='wt') as f2:
  time.sleep(1000)

ll /proc/pid/fd:查看进程号信息

 

posted @   修心的博客  阅读(36)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
点击右上角即可分享
微信分享提示