1.linux系统优化
#linux优化
#查看性能
ulimit -a
#修改打开文件数量
vi /etc/security/limits.conf
#配置详情
* soft nofile 65536
* hard nofile 68836
* soft nproc 4096
* hard nproc 4096
2.nginx优化(集群每台都要优化)
#user nobody;
#根据CPU的数量配置
worker_processes 4;
worker_rlimit_nofile 65535;
events {
worker_connections 20480;
}
http {
include mime.types;
default_type application/octet-stream;
#开启高效文件传输模式
sendfile on;
#减少网络报文段数量
#tcp_nopush on;
#提高I/O性能
tcp_nodelay on;
#keepalive_timeout 0;
keepalive_timeout 65;
#tracker节点负载均衡配置
upstream fastdfs_tracker {
server 172.16.1.83:8000 weight=1 max_fails=2 fail_timeout=30s;
server 172.16.1.74:8000 weight=1 max_fails=2 fail_timeout=30s;
}
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503