How many visitors can Linode 2G support ?
I'm using Linode 2G with nginx + php-fpm + mySql. When there are 100 visitors on my web, the loading time of webpages seems to be forever…
So I ran a load test for my web, it turns out only support 20 visitors when loading time is under 5 seconds.
Test image:
How can I improve configuration to support 100 visitors at same time and keep the loading time below 5 seconds ?
php-fpm:
pm = dynamic
pm.max_children = 24
pm.start_servers = 15
pm.min_spare_servers = 6
pm.max_spare_servers = 24
pm.max_requests = 250
request_terminate_timeout = 0
Btw, memory capacity is keeping around at 85%
[root@li953-245 ~]# top
top - 11:49:11 up 1 day, 15:27, 1 user, load average: 0.01, 0.03, 0.05
Tasks: 154 total, 1 running, 153 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 2047220k total, 1999660k used, 47560k free, 44656k buffers
Swap: 4194300k total, 58544k used, 4135756k free, 175844k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2783 mysql 20 0 1222m 120m 3500 S 0.0 6.0 1:30.40 mysqld
11317 apache 20 0 388m 95m 12m S 0.0 4.8 1:37.09 php-fpm
9887 apache 20 0 378m 85m 11m S 0.0 4.3 2:01.76 php-fpm
11057 apache 20 0 377m 84m 12m S 0.0 4.2 1:39.56 php-fpm
10922 apache 20 0 362m 77m 9520 S 0.0 3.9 1:41.23 php-fpm
10892 apache 20 0 361m 76m 9.8m S 0.0 3.8 1:40.06 php-fpm
10840 apache 20 0 361m 76m 9560 S 0.0 3.8 1:43.69 php-fpm
11023 apache 20 0 360m 74m 6472 S 0.0 3.7 1:39.23 php-fpm
11029 apache 20 0 358m 73m 9552 S 0.0 3.7 1:39.91 php-fpm
10913 apache 20 0 353m 69m 9.8m S 0.0 3.5 1:41.31 php-fpm
10868 apache 20 0 351m 66m 9520 S 0.0 3.3 1:43.81 php-fpm
11135 apache 20 0 351m 66m 9.9m S 0.0 3.3 1:39.65 php-fpm
9892 apache 20 0 351m 66m 9496 S 0.0 3.3 2:04.08 php-fpm
10895 apache 20 0 351m 66m 9520 S 0.0 3.3 1:42.02 php-fpm
11039 apache 20 0 351m 66m 9616 S 0.0 3.3 1:41.26 php-fpm
9717 apache 20 0 352m 66m 8652 S 0.0 3.3 2:05.06 php-fpm
11019 apache 20 0 351m 66m 9552 S 0.0 3.3 1:39.71 php-fpm
9899 apache 20 0 350m 65m 9516 S 0.0 3.3 2:03.81 php-fpm
11031 apache 20 0 350m 65m 9616 S 0.0 3.3 1:41.09 php-fpm
10872 apache 20 0 350m 65m 9520 S 0.0 3.3 1:42.91 php-fpm
9800 apache 20 0 350m 65m 8848 S 0.0 3.3 2:00.85 php-fpm
9898 apache 20 0 350m 64m 9252 S 0.0 3.2 2:02.28 php-fpm
9893 apache 20 0 350m 64m 8660 S 0.0 3.2 2:01.31 php-fpm
9897 apache 20 0 350m 64m 8640 S 0.0 3.2 2:02.64 php-fpm
9896 apache 20 0 350m 62m 6508 S 0.0 3.1 2:02.79 php-fpm
15749 nobody 20 0 95596 18m 10m S 0.0 0.9 0:05.61 nginx
15750 nobody 20 0 95200 18m 10m S 0.0 0.9 0:05.26 nginx
2572 root 20 0 198m 15m 3440 S 0.0 0.8 0:38.65 perl
18717 root 20 0 145m 13m 12m S 0.0 0.7 0:00.08 sshd
[root@li953-245 ~]# ps -A --sort -rss -o comm,pmem,pcpu |uniq -c |head -15
1 COMMAND %MEM %CPU
1 mysqld 6.0 0.0
1 php-fpm 4.7 0.1
2 php-fpm 4.2 0.1
3 php-fpm 3.8 0.1
1 php-fpm 3.7 0.1
1 php-fpm 3.6 0.1
1 php-fpm 3.4 0.1
7 php-fpm 3.3 0.1
7 php-fpm 3.2 0.1
1 php-fpm 3.1 0.1
2 nginx 0.9 0.0
1 perl 0.7 0.0
1 sshd 0.6 0.1
7 Replies
(Assuming you still have some free RAM).
@sanvila:
Did you try increasing pm.max_children?
(Assuming you still have some free RAM).
Yes , I tried and more max_children means more RAM occupied as you can imagine.
Does that meas I have to update to Linode 4G or 8G to support 100 visitors at same time ?
Thank you!
@hunini2010:
Does that mean I have to update to Linode 4G or 8G to support 100 visitors at same time ?
Not necessarily. You might want to try other things first. For example, php7 is said to be twice as fast as php5, which means requests are handled faster and therefore you can serve more requests per second.
There are also caching solutions that you might want to evaluate, either generic, like Varnish, or CMS-specific (for whatever CMS you are using).
In either case, I'm not sure we are using the right terminology here. You speak about "visitors", but the web server only understand about "requests". What you have measured, I think, is the number of simultaneous requests that your system can handle. On one hand, a "visitor" can make several request at once, on the other hand, a request can take very little time to be processed.
If you can handle 100 simultaneous requests and each request takes one second, your web server would handle more than 8 million
requests per day. Do you really have such a busy web site?
@sanvila:
@hunini2010:Does that mean I have to update to Linode 4G or 8G to support 100 visitors at same time ?
Not necessarily. You might want to try other things first. For example, php7 is said to be twice as fast as php5, which means requests are handled faster and therefore you can serve more requests per second.
There are also caching solutions that you might want to evaluate, either generic, like Varnish, or CMS-specific (for whatever CMS you are using).
In either case, I'm not sure we are using the right terminology here. You speak about "visitors", but the web server only understand about "requests". What you have measured, I think, is the number of simultaneous requests that your system can handle. On one hand, a "visitor" can make several request at once, on the other hand, a request can take very little time to be processed.
If you can handle 100 simultaneous requests and each request takes one second, your web server would handle more than 8 million
requests per day. Do you really have such a busy web site?
Thank you for your reply. Regarding "visitors", I mean unique visitors. There are just about 10K unique visitors and 20K page views per day on my web. On peak hour, there are 700 visitors and 1600 page views. Meanwhile, I found my web is hard to load when there are 100 visitors, but I'm not sure the number of "request", may be 30 or more requests at that second?
My web is made by Wordpress CMS, and I'm using Cloudflare for catching and nginx as web server.
Will CLOUDFLARE + VARNISH + APACHE + NGINX be a better solution? Do I still need the other caching plugin of Wordpress such as W3 Total Cache ?
Thank you !
@hunini2010:
My web is made by Wordpress CMS, and I'm using Cloudflare for catching and nginx as web server.
Will CLOUDFLARE + VARNISH + APACHE + NGINX be a better solution? Do I still need the other caching plugin of Wordpress such as W3 Total Cache ?
I have not used all that myself, but W3 Total Cache and Cloudflare seem to work well together:
so I would try W3 Total Cache first.
Also, I would not bother with Apache if you are already using nginx.
@sanvila:
BTW: If you had a Linode 2G, you can now have a Linode 4G for the same price:
Thank you so much for your information!
I'm studying Cloudflare + Varnish + W3 total cathe now, hope they can work well.