0

Server is E3-1240v3
32GB Ram

If i try to change the values on those files, they limit the visitors to 3k to 5k.
This setting however handles upto 9k

But the server resources are almost free.

I am struggling to handle a traffic of 10K+ It will reach a lot. But my bad configuration is limiting them.

www.conf

pm.max_children = 400
pm.start_servers = 40
pm.min_spare_servers = 40
pm.max_spare_servers = 70
pm.max_requests = 800

nginx.conf

worker_processes 3;
events {
worker_connections 8096;
accept_mutex on;
accept_mutex_delay 500ms;
multi_accept on;
use epoll;
}

sendfile on;
tcp_nodelay on;
tcp_nopush on;


client_body_buffer_size 128K;
client_max_body_size 8m;

client_body_timeout 15;
client_header_timeout 15;
send_timeout 10;
keepalive_timeout 15; 

open_file_cache max=5000 inactive=20s;
open_file_cache_valid 60s;
open_file_cache_min_uses 4;
open_file_cache_errors on;

How can i effectively configure to handle more visitors?

EDIT

top -c

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
22093 nginx     20   0  393060  11848   3828 S  31.9  0.0  10:17.70 php-fpm: pool www
 1495 mysql     20   0 4793852 318444   9824 S  23.6  1.0 796:41.59 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin -+
 3135 nginx     20   0  393108  12112   3832 R   7.3  0.0  10:30.35 php-fpm: pool www
 6839 nginx     20   0  392804  11832   3828 R   7.3  0.0  10:37.57 php-fpm: pool www
14311 nginx     20   0  392800  11820   3828 S   7.3  0.0  10:39.68 php-fpm: pool www
  889 nginx     20   0  393072  11832   3828 R   7.0  0.0  10:38.91 php-fpm: pool www
 1153 nginx     20   0  393100  12100   3832 S   7.0  0.0  10:38.73 php-fpm: pool www
 5768 nginx     20   0  392736  11708   3836 R   7.0  0.0  10:49.05 php-fpm: pool www
 6675 nginx     20   0  393100  11892   3832 S   7.0  0.0  10:38.87 php-fpm: pool www
 6840 nginx     20   0  393108  12136   3832 S   7.0  0.0  10:35.61 php-fpm: pool www
12767 nginx     20   0  393156  12092   3832 R   7.0  0.0  10:23.34 php-fpm: pool www
21948 nginx     20   0  393108  12132   3828 S   7.0  0.0  10:18.22 php-fpm: pool www
  888 nginx     20   0  392800  11848   3848 S   6.6  0.0  10:41.74 php-fpm: pool www
 1152 nginx     20   0  393092  11928   3836 R   6.6  0.0  10:37.03 php-fpm: pool www
 5036 nginx     20   0  393076  11852   3848 S   6.6  0.0  10:41.52 php-fpm: pool www
12692 nginx     20   0  393056  11832   3828 S   6.6  0.0  10:25.90 php-fpm: pool www
22033 nginx     20   0  393076  11904   3832 S   6.6  0.0  10:09.92 php-fpm: pool www
22034 nginx     20   0  393092  11864   3832 S   6.6  0.0  10:14.02 php-fpm: pool www
22092 nginx     20   0  392800  11832   3832 S   6.6  0.0  10:22.43 php-fpm: pool www
22184 nginx     20   0  393108  12100   3832 S   6.6  0.0  10:17.56 php-fpm: pool www
22185 nginx     20   0  393104  12100   3832 S   6.6  0.0  10:14.99 php-fpm: pool www
27712 nginx     20   0  393100  12116   3848 S   6.6  0.0  10:47.98 php-fpm: pool www
  790 nginx     20   0  393108  12096   3832 S   6.3  0.0  10:41.45 php-fpm: pool www
 1063 nginx     20   0  392548  11584   3836 S   6.3  0.0  10:47.35 php-fpm: pool www
 3058 nginx     20   0  393124  12100   3832 R   6.3  0.0  10:35.90 php-fpm: pool www
 5933 nginx     20   0  392800  11832   3836 S   6.3  0.0  10:43.31 php-fpm: pool www
 6737 nginx     20   0  393056  11840   3828 S   6.3  0.0  10:36.62 php-fpm: pool www
 6838 nginx     20   0  393056  11932   3832 S   6.3  0.0  10:37.22 php-fpm: pool www
13061 nginx     20   0  393140  11896   3836 R   6.3  0.0  10:33.85 php-fpm: pool www
13146 nginx     20   0  392820  11832   3828 R   6.3  0.0  10:39.73 php-fpm: pool www
22183 nginx     20   0  392924  11724   3828 S   6.3  0.0  10:18.64 php-fpm: pool www
 3134 nginx     20   0  393108  12104   3828 S   6.0  0.0  10:38.90 php-fpm: pool www
 6736 nginx     20   0  393100  12112   3828 S   6.0  0.0  10:30.51 php-fpm: pool www
22091 nginx     20   0  392800  11832   3832 S   6.0  0.0  10:15.83 php-fpm: pool www
10880 nginx     20   0  392804  11844   3844 S   5.6  0.0  10:40.13 php-fpm: pool www
22090 nginx     20   0  393076  11876   3828 S   5.6  0.0  10:21.79 php-fpm: pool www
10430 nginx     20   0   53984   7700   1200 S   1.7  0.0   0:33.71 nginx: worker process


Tasks: 197 total,   4 running, 192 sleeping,   0 stopped,   1 zombie
%Cpu(s): 25.6 us,  2.3 sy,  0.0 ni, 71.9 id,  0.0 wa,  0.0 hi,  0.2 si,  0.0 st
KiB Mem : 32740464 total, 29158440 free,   892028 used,  2689996 buff/cache
KiB Swap:  8191996 total,  8191996 free,        0 used. 31303316 avail Mem
Mahesh
  • 247
  • 1
  • 4
  • 16
  • Your question is far too vague and doesn't have the information required to answer your question. I would expect to see information about resource usage (top / iotop / etc), information about what the server is doing, perhaps any relevant logs, installed software stack, and probably more. – Tim Oct 16 '17 at 16:51
  • oops my mistake. will add the top -c screenshot – Mahesh Oct 16 '17 at 16:54
  • You're using 2.5 cores, the server has 4 cores / 8 threads - that should have been stated clearly in your question. PHP is using most of the CPU, with MySQL using a little. You seem to have configured PHP to be able to create up to 400 worker threads. I would look at two things to start with 1) Why no more PHP workers are being created (check the PHP logs) 2) Page caching anonymous user requests - some info [here](https://www.photographerstechsupport.com/tutorials/hosting-wordpress-on-aws-tutorial-part-4-wordpress-website-optimization/). – Tim Oct 16 '17 at 17:25
  • 3/5/9/10k per *what*? Per hour? Per day? Concurrent? – ceejayoz Oct 16 '17 at 19:40

1 Answers1

-1

Your question lacks the following inrormation: - would be nice to have the graph showing the number of busy php workers vs idle ones. This information could be extracted from php-fpm itself, using it's embedded server statistics functionality - it's configured using pm.status_path keyword. - would be nice to see the average/typical $request_time from the nginx logs. This value is absent from combined logformat, so you'll have to modify it.

From the info that you provided, however, one conclusion can be made: the bottleneck here is probably your application itself, which is waiting/blocking for something. Some of your php workers could be even idle, you need to collect the statistics. So that's why increasing the worker number gives you nothing or ever the regression. You need to investigate further what's preventing your application to handle more requests - it may be the database (if any), the external web requests (if any) or the code itself.

drookie
  • 8,625
  • 1
  • 19
  • 29