Tuning server for hundreds/thousands contemporary rest api calls
i have built a web application in PHP-Laravel 5 versus MariaDB that exposes rest services that will be called
from a mobile app during a sport event [with about 8000 spectators]
where the crowd will be invited to download and use the app to see the results in real time.
Obviously i need no errors and a good response from the webserver; i actually have
Linode1024, i think to upgrade it for the event but i would like to understand how to upgrade the server and fine tune it.
I actually use Apache 2.4.6 and don't know if nginx can be a better choice (maybe i will try it).
Here is the ouput from Siege:
concurrent = 100 - 1Minute
Lifting the server siege…
Transactions: 2892 hits
Availability: 100.00 %
Elapsed time: 59.43 secs
Data transferred: 3.06 MB
Response time: 1.78 secs
Transaction rate: 48.66 trans/sec
Throughput: 0.05 MB/sec
Concurrency: 86.58
Successful transactions: 2892
Failed transactions: 0
Longest transaction: 5.40
Shortest transaction: 0.55
concurrent = 150 - 1Minute
Lifting the server siege…
Transactions: 2405 hits
Availability: 100.00 %
Elapsed time: 59.89 secs
Data transferred: 1.92 MB
Response time: 3.34 secs
Transaction rate: 40.16 trans/sec
Throughput: 0.03 MB/sec
Concurrency: 134.25
Successful transactions: 2405
Failed transactions: 0
Longest transaction: 6.80
Shortest transaction: 0.20
concurrent = 255 - 1Minute
Lifting the server siege…
Transactions: 2231 hits
Availability: 99.60 %
Elapsed time: 60.48 secs
Data transferred: 1.79 MB
Response time: 5.64 secs
Transaction rate: 36.89 trans/sec
Throughput: 0.03 MB/sec
Concurrency: 207.92
Successful transactions: 2231
Failed transactions: 9
Longest transaction: 36.99
Shortest transaction: 0.23
Here is the 'top' output during siege:
top - 11:00:43 up 141 days, 11:37, 2 users, load average: 25.88, 13.04, 7.81
Tasks: 160 total, 79 running, 81 sleeping, 0 stopped, 0 zombie
%Cpu(s): 75.4 us, 22.7 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 1.6 si, 0.3 st
KiB Mem : 1010988 total, 209912 free, 628644 used, 172432 buff/cache
KiB Swap: 262140 total, 110920 free, 151220 used. 309372 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
20261 mysql 20 0 1200024 15652 5416 S 6.2 1.5 0:10.66 mysqld
22653 root 20 0 2649308 111288 1864 S 2.2 11.0 0:00.78 siege
21494 apache 20 0 601528 34352 22812 R 1.6 3.4 0:01.80 httpd
22948 apache 20 0 600208 32712 22812 R 1.6 3.2 0:00.54 httpd
23059 apache 20 0 600720 33228 22812 R 1.6 3.3 0:00.33 httpd
23090 apache 20 0 600464 32964 22812 R 1.6 3.3 0:00.28 httpd
23133 apache 20 0 599696 32176 22812 R 1.6 3.2 0:00.22 httpd
23206 apache 20 0 601520 34356 22812 R 1.6 3.4 0:00.13 httpd
23242 apache 20 0 600208 32700 22812 R 1.6 3.2 0:00.08 httpd
23262 apache 20 0 600464 32964 22812 R 1.6 3.3 0:00.06 httpd
21492 apache 20 0 599696 32180 22812 R 1.2 3.2 0:01.80 httpd
21833 apache 20 0 600720 33504 22812 R 1.2 3.3 0:01.52 httpd
21911 apache 20 0 599952 32436 22812 R 1.2 3.2 0:01.10 httpd
21948 apache 20 0 598672 31656 22812 R 1.2 3.1 0:01.30 httpd
21964 apache 20 0 600976 33500 22812 R 1.2 3.3 0:00.99 httpd
21991 apache 20 0 600464 32976 22812 R 1.2 3.3 0:01.25 httpd
22030 apache 20 0 600720 33228 22812 R 1.2 3.3 0:01.21 httpd
22043 apache 20 0 599440 31916 22812 R 1.2 3.2 0:01.20 httpd
22911 apache 20 0 600464 32964 22812 R 1.2 3.3 0:00.61 httpd
22973 apache 20 0 601532 34300 22812 R 1.2 3.4 0:00.47 httpd
22981 apache 20 0 600464 32972 22812 R 1.2 3.3 0:00.46 httpd
Can anyone help me in understanding where i can improve my server?
Thanks in advance and greetings
2 Replies
I see that you accepted the defaul 256 MB of swap. For a Linode 1024, I use 1024 MB of swap. Not necessarily to be used, but as a safety net to avoid OOM killer to think you don't have enough memory. You don't want mysql to be killed randomly in the middle of your sport event.
@sanvila:
If you are still using Apache in prefork mode with mod_php, consider using PHP-FPM instead.
I see that you accepted the defaul 256 MB of swap. For a Linode 1024, I use 1024 MB of swap. Not necessarily to be used, but as a safety net to avoid OOM killer to think you don't have enough memory. You don't want mysql to be killed randomly in the middle of your sport event.
Hello, thank you for your answer; i have then installed nginx and performances are quit good. I will upgrade to Linode 16384 for the event days and will increase swap space.
Thanks and greetings