1.性能优化考虑点
1.当前系统结构瓶颈
观察指标 压力测试
2.了解业务模式
接口业务类型、系统层次化结构
3.性能与安全
一、ab压力测试工具
1.安装 yum install httpd-tools
2.使用 ab -n 2000 -c 2 http://127.0.0.1
-n 总请求次数
-c 并发次数
-k 是否开启长连接
二、文件句柄设置
/etc/security/limits.conf
1.系统全局性修改
* soft nofile 65535
* hard nofile 65535
2.用户局部性修改
root soft nofile 65535
root hard nofile 65535
3.进程局部性修改
/etc/nginx/nginx.conf
worker_rlimit_nofile 65535
三、CPU亲和
查看处理器数量
cat /proc/cpuinfo |grep "physical id"|sort|uniq|wc -l
查看单个处理器核数
cat /proc/cpuinfo |grep "cpu cores"|sort|uniq|wc -l
user nginx;
#等于CPU核数
worker_processes 16;
worker_cpu_affinity 0000000000000001 0000000000000010 0000000000000100 0000000000001000 0000000000010000 0000000000100000 0000000001000000 0000000010000000 0000000100000000 0000001000000000 0000010000000000 0000100000000000 0001000000000000 0010000000000000 0100000000000000 1000000000000000;