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