mac修改打开文件数和进程数
现象
sudo ulimit -n 65535
/usr/bin/ulimit: line 4: ulimit: open files: cannot modify limit: Invalid argument
方案
➜ ~ echo kern.maxfiles=65535 | sudo tee -a /etc/sysctl.conf
Password:
kern.maxfiles=65535
➜ ~ echo kern.maxfilesperproc=65535 | sudo tee -a /etc/sysctl.conf
kern.maxfilesperproc=65535
➜ ~ sudo sysctl -w kern.maxfiles=65535
kern.maxfiles: 12288 -> 65535
➜ ~ sudo sysctl -w kern.maxfilesperproc=65535
kern.maxfilesperproc: 10240 -> 65535
➜ ~ ulimit -n 65535 65535
➜ ~ ulimit -a
现象
kernel: TCP: request_sock_TCP: Possible SYN flooding on port 8888. Sending cookies. Check SNMP counters.
方案
# sysctl net.core.somaxconn
net.core.somaxconn = 128
改为2048
# sysctl -w net.core.somaxconn=2048
持久化到配置文件,下次重启自动生效:
# echo "net.core.somaxconn = 2048" >> /etc/sysctl.conf
linux:ab post :
> ab -p /data/tomcatlogs/llb-api/logs/post1.txt -T 'application/json' -k -c 1000 -n 10000 localhost:8102/xxxx
post1.txt 格式为json:如
{
"keyWord":"test虚拟","searchType":7
}