Welcome! Log In Create A New Profile

Advanced

Heavy load because of concurrent users on Nginx and php-fpm causes 502 bad gateway error.

Posted by ehussain 
Hi,

I have Nginx + PHP FPM installed on my server. We are putting load on server for long period for 30 concurrent users.

For initial user it works fine but after some time it starts throwing 502 bad gateway error.

I have placed some of the log of nginx php-fpm and slow log of php-fpm.

There are entries getting logged in slow log of php-fpm because of long running script and load on server. I think this is the reason for 502 bad gateway error. But I dont know how to solve that problem.

- What are the tweaks I need to make in php-fpm.conf so that this errors gets resolved?
- How to make nginx wait for long time for response from php-fpm?
- How to increase php-fpm max execution time?

Here are the logs attached.

========================= NGINX LOG=====================================

2013/01/29 15:03:38 [error] 2493#0: *1046562 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 49.248.0.2, server: ***********.com, request: "GET MY_SCRIPT_URI HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "***********.com", referrer: "MY_SCRIPT_URL"

2013/01/29 15:03:39 [error] 2493#0: *1046561 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 49.248.0.2, server: **********.com, request: "GET MY_SCRIPT_URI HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "***********.com", referrer: "MY_SCRIPT_URL"

There are many errors of this type and they are repeating in entire file.

============================== PHP FPM LOG =================================

[14-Feb-2013 12:54:13] ERROR: failed to ptrace(PEEKDATA) pid 10748: Input/output error (5)
[14-Feb-2013 12:54:18] ERROR: failed to ptrace(PEEKDATA) pid 10112: Input/output error (5)
[14-Feb-2013 12:54:18] ERROR: failed to ptrace(PEEKDATA) pid 12147: Input/output error (5)
[14-Feb-2013 12:54:19] ERROR: failed to ptrace(PEEKDATA) pid 30857: Input/output error (5)
[14-Feb-2013 12:54:19] ERROR: failed to ptrace(PEEKDATA) pid 9568: Input/output error (5)
[14-Feb-2013 12:54:19] ERROR: failed to ptrace(PEEKDATA) pid 32519: Input/output error (5)
[14-Feb-2013 12:54:23] ERROR: failed to ptrace(PEEKDATA) pid 31361: Input/output error (5)
[14-Feb-2013 12:54:23] ERROR: failed to ptrace(PEEKDATA) pid 9014: Input/output error (5)
[14-Feb-2013 12:54:23] ERROR: failed to ptrace(PEEKDATA) pid 10789: Input/output error (5)
[14-Feb-2013 12:54:23] ERROR: failed to ptrace(PEEKDATA) pid 840: Input/output error (5)
[14-Feb-2013 12:54:23] ERROR: failed to ptrace(PEEKDATA) pid 953: Input/output error (5)
[14-Feb-2013 12:54:26] ERROR: failed to ptrace(PEEKDATA) pid 10927: Input/output error (5)
[14-Feb-2013 12:54:26] ERROR: failed to ptrace(PEEKDATA) pid 9012: Input/output error (5)
[14-Feb-2013 12:54:26] ERROR: failed to ptrace(PEEKDATA) pid 10861: Input/output error (5)
[14-Feb-2013 12:54:39] ERROR: failed to ptrace(PEEKDATA) pid 31361: Input/output error (5)
[14-Feb-2013 12:54:58] ERROR: failed to ptrace(PEEKDATA) pid 10102: Input/output error (5)
[14-Feb-2013 12:54:58] ERROR: failed to ptrace(PEEKDATA) pid 10918: Input/output error (5)
[14-Feb-2013 12:54:58] ERROR: failed to ptrace(PEEKDATA) pid 32519: Input/output error (5)
[14-Feb-2013 12:54:59] ERROR: failed to ptrace(PEEKDATA) pid 9326: Input/output error (5)
[14-Feb-2013 12:54:59] ERROR: failed to ptrace(PEEKDATA) pid 10789: Input/output error (5)
[14-Feb-2013 12:55:08] ERROR: failed to ptrace(PEEKDATA) pid 10943: Input/output error (5)
[14-Feb-2013 12:55:08] ERROR: failed to ptrace(PEEKDATA) pid 31850: Input/output error (5)
[14-Feb-2013 12:55:08] ERROR: failed to ptrace(PEEKDATA) pid 31898: Input/output error (5)
[14-Feb-2013 12:55:08] ERROR: failed to ptrace(PEEKDATA) pid 32737: Input/output error (5)
[14-Feb-2013 12:55:13] ERROR: failed to ptrace(PEEKDATA) pid 10748: Input/output error (5)
[14-Feb-2013 12:55:13] ERROR: failed to ptrace(PEEKDATA) pid 10117: Input/output error (5)


============================== PHP FPM SLOW LOG =================================

[14-Feb-2013 12:55:13] [pool www] pid 10748
script_filename = MY_SCRIPT_PATH
[0x00007f446e8e06b0] curl_exec() MY_SCRIPT_PATH_1.php:317
[0x00007f446e8e0490] callService() MY_SCRIPT_PATH_2:1331
[0x00007f446e8e0148] convertToPurchaseOrders() MY_SCRIPT_PATH_3:15
[0x00007fff0102b4d0] convertToPurchaseOrders() unknown:0
[0x00007f446e8de0d8] call_user_func_array() MY_SCRIPT_PATH_4:359
[0x00007f446e8dd4d0] +++ dump failed

[14-Feb-2013 12:55:13] [pool www] pid 10117
script_filename = MY_SCRIPT_PATH
[0x00007f446e8e06b0] curl_exec() MY_SCRIPT_PATH_1.php:317
[0x00007f446e8e0490] callService() MY_SCRIPT_PATH_2:1331
[0x00007f446e8e0148] convert() MY_SCRIPT_PATH_3:15
[0x00007fff0102b4d0] convert() unknown:0
[0x00007f446e8de0d8] call_user_func_array() MY_SCRIPT_PATH_4:359
[0x00007f446e8dd4d0] +++ dump failed



Help is appriciated.

Thanks in advance.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 301
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready