we are working on an online Exam system which will have high traffic at the same time, the system developed using laravel and MySQL as database. our server has 40 core and 64 GB RAM memory. I installed Nginx in a docker container PHP in another container Mysql in another container, also we tested the system with the classic way, where all services working in the same server directly without docker. but the problem is the system can not handle more than 600 Users at the same time. we tried with Nginx performance tunes and nothings works, and also with php-fpm. I don't know why is that happening, we tried with all architecture that can help but nothings work, every PHP-fpm process using 27% of CPU. and when I am using
ApacheBench
in order to send requests to the server and then trying to load the home page from my browser it taking a long time to respond to the page and many times return time-out. I am using Nginx:stable-alpine
as Nginx docker image.
php:7.4-fpm-alpine
as PHP image. I did not change any of the default configs for PHP or Nginx. so what is the best configuration for PHP and Nginx which I have to apply in order to have the best performance?
htop result before send requests
htop after send request using
sudo ab -n 5000 -c 600 https://demo.qsinav.com/
Rate Per Second = RPS
Suggestions to consider for your my.cnf [mysqld] section
thread_cache_size=100 # from 9 to reduce threads_created RPhr of 78
net_buffer_length=32K # from 16K to reduce # packets per hour
query_cache_size=0 # from 1M to conserve RAM because the QCtype of OFF
slow_query_log=ON # from OFF to allow awareness and proactively correct
long_query_time=1 # from 10 seconds - if overwhelmed with entries, raise the seconds by 1
innodb_write_io_threads=64 # from 4 to expedite writing to tables on storage devices
There are many more opportunities to improve configuration. View profile, Network profile for free downloadable Utility Scripts to assist with performance tuning, specifically findfragtables.sql is helpful with reminding you to OPTIMIZE heavily used tables periodically.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.