0

I have Azure Server with Linux & hosted Web based application which is unable to handle the request more than 800 concurrent users. Present server configuration is 16 core with 32 GB RAM. Error log in Apache http.conf is

[Wed Jul 07 22:21:33.634756 2021] [proxy_fcgi:error] [pid 5489:tid 47478298437376] (70008)Partial results are valid but processing is incomplete: AH01075: Error dispatching request to : (reading input brigade):

Note that process used in the application is file upload and database insert.

Yanis-git
  • 7,737
  • 3
  • 24
  • 41
BINOD DEKA
  • 41
  • 7
  • This error occurs when Apache thinks it has a valid FCGI worker, but the worker has shut down. I've previously encountered this where Apache was configured to invoke `php-cgi` with a wrapper script, and the workers were recycling themselves after N requests. This is what happens on the N+1th request. The solution is to use a proper FCGI process manager, eg: PHP-FPM. – Sammitch Jul 07 '21 at 18:27

1 Answers1

0

General question you should ask to yourself

  • What is your context ?
  • What exactly slow down your request ? is it all ? is it only specific request ?
  • 5000 Users is per seconds, minutes, day ? Do you have any pick of traffic ?
  • Do you run latest version of Apache/Nginx PHP7+ and MySQL ?
  • Do you use Commit flush rollback pattern with your PHP code for pushing query to MySQL ?

enable option like on PHP-fpm will help to identify

request_slowlog_timeout = 6s
slowlog = /var/log/php-fpm/slowlog-site.log

even MySQL and Nginx can keep track of slow Query. (see source for more detail)


For Apache

I recommend you to switch to nginx, it have master / slave sub process to multithread your request.

http {
  worker_processes auto; // will let Nginx manage by itself how many sub process can be spawn. more core you have more request you can take at once processor tick 
}

also you should probably disable access_log as much as you can (example for static file, it will reduce writing operation on disk).

Nginx will act as proxy with PHP-FPM. You should go to the Unix socket options for that.

PHP-FPM

Log: Same here, try to condensate at once your log writing operation during your request flow.

Sub process: Play with Process Manager configuration inside your php-fpm www.conf. you should find section like

listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 5
pm.max_requests = 150

which is basically, how many child PHP process can be run at the same time, how much should be always be running in idle etc. (see source for more detail)

OpCache: Be sure OpCache is enable and configure for a long term caching. Xdebug: On production you should disable it to reduce resource footprints.

MySQL

As said on introduction, is important to reduce number of socket traffic between PHP and MySQL, use PDO commit / execution is a good way to reduce your internal traffic.

Use innodb engine for your database and play around innodb configuration to encrease available cache memory, ram.

Hope this will help to try by your hand to find the perfect configuration for your config and your context.


Source

Yanis-git
  • 7,737
  • 3
  • 24
  • 41