• Nginx系列(十二)——性能调整


    Performance Tuning
    调整性能

    Automating Tests with Load Drivers
    常用负载测试工具
    JMeter, Locust,Gatling


    Keeping Connections Open to Clients
    http {
    keepalive_requests 320;
    keepalive_timeout 300s;
    ...
    }


    Keeping Connections Open Upstream
    保持负载均衡链接
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    upstream backend {
    server 10.0.0.42;
    server 10.0.2.56;
    keepalive 32;
    }

    Buffering Responses
    缓冲响应,避免写响应到临时文件
    response bodies:
    server {
    proxy_buffering on;
    proxy_buffer_size 8k;
    proxy_buffers 8 32k; #缓冲数量和缓冲大小
    proxy_busy_buffer_size 64k;
    ...
    }


    Buffering Access Logs
    缓冲请求日志,当系统负载高的时候
    http {
    access_log /var/log/nginx/access.log main buffer=32k flush=1m; #当日志占满32k的内容时才写入磁盘中,flush用于指定日志数据在内存中最长的存留时间
    }


    OS Tuning
    调整系统参数
    例如以下参数:
    net.core.somaxconn #maximum number of connections
    sys.fs.file_max #最大文件描述符/etc/security/limits.conf
    worker_connections #nginx配置
    worker_rlimit_nofile #nginx配置
    net.ipv4.ip_local_port_range #端口范围

  • 相关阅读:
    UVA 10617 Again Palindrome
    UVA 10154 Weights and Measures
    UVA 10201 Adventures in Moving Part IV
    UVA 10313 Pay the Price
    UVA 10271 Chopsticks
    Restore DB後設置指引 for maximo
    每行SQL語句加go換行
    种服务器角色所拥有的权限
    Framework X support IPV6?
    模擬DeadLock
  • 原文地址:https://www.cnblogs.com/biaopei/p/12953673.html
Copyright © 2020-2023  润新知