优化Linux的内核参数来提高服务器并发处理能力

修改linux内核

ulimit -n 65535

nginx优化

access日志优化Error日志优化,减少磁盘IO

worker_processes auto; #设置为cpu核心数或者auto

worker_rlimit_nofile 65535; #与ulimit保持一致

events

events{
  worker_connections 65535; #单进程最大连接数
}

http

http{
  server_names_hash_bucket_size 128; #服务器名字的hash表大小
  client_header_buffer_size 32k; #上传文件大小限制
  large_client_header_buffers 4 64k; #设定请求缓
  client_max_body_size 8m; #设定请求缓

  fastcgi_connect_timeout 300;
  fastcgi_send_timeout 300;
  fastcgi_read_timeout 300;
  fastcgi_buffer_size 64k;
  fastcgi_buffers 4 64k;
  fastcgi_busy_buffers_size 128k;
  fastcgi_temp_file_write_size 128k;

}
添加新评论