038_nginx backlog配置


一、

backlog=number
sets the backlog parameter in the listen() call that limits the maximum length for the queue of pending connections. By default, backlog is set to -1 on FreeBSD, DragonFly BSD, and macOS, and to 511 on other platforms.

(1)net.core.somaxconn參數:能夠被nginx緩存隊列的最大的連接數量,如何你的nginx遇到比較大的流量時,系統kernel日志messages中會出現這個值太小的報錯,可以修改這個默認參數增大它的值.Notice:如何你設置的值大於512,在nginx listen指令后設置與其匹配的值.

cat /proc/sys/net/core/somaxconn    #系統默認值
65535

(2)net.core.netdev_max_backlog參數:被切換到CPU處理前被網卡緩存的速率包,根據網卡文檔加大值可以提高性能.

cat /proc/sys/net/core/netdev_max_backlog
65535  

 其他優化及參考:

(1)https://www.04007.cn/article/323.html   nginx配置文件中listen后面的backlog配置

(2)https://huoding.com/2014/08/13/367    一次優化引發的血案

Reference: https://www.nginx.com/blog/tuning-nginx/

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM