502 Gateway Errors under High Load (nginx/php-fpm)

前端 未结 4 1034
滥情空心
滥情空心 2020-12-12 10:51

I work for a rather busy internet site that is often gets very large spikes of traffic. During these spikes hundreds of pages per second are requested and this produces rand

相关标签:
4条回答
  • 2020-12-12 11:44

    If it's not helping in some cases - use normal port bind instead of socket, because socket on 300+ can block new requests forcing nginx to show 502.

    0 讨论(0)
  • 2020-12-12 11:45

    Unix socket accept 128 connections by default. It is good to put this line into /etc/sysctl.conf

    net.core.somaxconn = 4096
    
    0 讨论(0)
  • 2020-12-12 11:46

    @Mr. Boon

    I have 8 core 14 GB ram. But the system gives Gateway time-out very often.
    Implementing below fix also didn't solved the issue. Still searching for better fixes.

    You have: fastcgi_buffers 4 256k;

    Change it to:

    fastcgi_buffers 256 16k; // 4096k total

    Also set fastcgi_max_temp_file_size 0, that will disable buffering to disk if replies start to exceed your fastcgi buffers.

    Thanks.

    0 讨论(0)
  • 2020-12-12 11:55

    This should fix it...

    You have: fastcgi_buffers 4 256k;

    Change it to: fastcgi_buffers 256 16k; // 4096k total

    Also set fastcgi_max_temp_file_size 0, that will disable buffering to disk if replies start to exceeed your fastcgi buffers.

    0 讨论(0)
提交回复
热议问题