0
Server rất chậm khi user online > 2000
Chào mn, mình đang vận hành 1 VPS, tốc độ truy cập rất chậm khi nhiều người truy cập.
Cấu hình SV:
- Server chạy ubuntu 20, dùng Laradock deploy:
- Mysql 8.0
- PHP 7.4, PHP-FPM
- Redis
- ...
Ram, CPU, Disk vẫn bình thường.
Mình thử cấu hình PM PHP-FPM
pm = dynamic
; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 25
; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 10
; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 5
; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 20
nhưng vẫn không có gì thay đổi. mn cho mình xin giải pháp cho vấn đề này, tks
Thêm một bình luận
1 CÂU TRẢ LỜI
+1
Bạn thử check xem số lượng containers php-fpm mà mình đang chạy là bao nhiêu? xong rồi thử tăng số lượng containers php-fpm lên xem sao
@thangtd90 Tăng containers php-fpm như nào b? mình check stats
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
d63bcf95148a laradock_php-fpm_1 42.07% 750.6MiB / 15.64GiB 4.69% 162GB / 101GB 13.1MB / 868MB 51
top
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
694872 systemd+ 20 0 4954292 2.9g 38284 S 415.6 18.5 2772:01 mysqld
1413124 1000 20 0 457652 112220 90876 S 41.1 0.7 1:12.53 php-fpm
1413657 1000 20 0 476012 142028 102732 S 41.1 0.9 1:19.55 php-fpm
695717 root 20 0 1494632 743696 24132 S 17.9 4.5 79:38.68 caddy
1415722 1000 20 0 451336 111752 96580 R 17.9 0.7 1:14.74 php-fpm
1415780 1000 20 0 465876 124532 96780 S 16.2 0.8 1:03.62 php-fpm
1413885 1000 20 0 452448 113164 97052 S 14.6 0.7 1:20.02 php-fpm
1413544 1000 20 0 461992 119760 97324 R 13.2 0.7 1:15.86 php-fpm
1412778 1000 20 0 451304 103504 90648 R 8.6 0.6 1:10.01 php-fpm
1412738 1000 20 0 455408 116832 98156 S 8.3 0.7 1:22.31 php-fpm
1413566 1000 20 0 452384 114180 98116 R 7.9 0.7 1:16.79 php-fpm
1412829 1000 20 0 449220 104036 90980 S 7.6 0.6 1:18.32 php-fpm
1412680 1000 20 0 451344 103428 90496 S 6.6 0.6 1:16.97 php-fpm
1413595 1000 20 0 451416 113692 98536 S 6.3 0.7 1:12.84 php-fpm
1413285 1000 20 0 449480 109056 95908 S 5.6 0.7 1:17.10 php-fpm
1450463 1000 20 0 452592 94160 77848 S 5.3 0.6 0:03.92 php-fpm
786 root 20 0 1973008 84564 20036 S 5.0 0.5 469:09.56 dockerd
1413628 1000 20 0 455392 109288 90908 S 3.3 0.7 1:18.19 php-fpm
1443147 1000 20 0 54308 41604 11392 R 3.3 0.3 0:11.28 php
1450946 1000 20 0 54308 41764 11556 R 3.3 0.3 0:02.42 php
1412803 1000 20 0 453348 113344 96808 R 3.0 0.7 1:08.56 php-fpm
@s2banggia88 Bạn thử dùng
docker-compose up -d --scale php-fpm=5
xem sao
hoặc
docker-compose scale php-fpm=5
ERROR: for laradock_php-fpm_3 Cannot start service php-fpm: driver failed programming external connectivity on endpoint laradock_php-fpm_3 (80942ebe80b9b24baa6abf6258e8f43b471e04dc882bb3cbe448882169da47a0): Bind for 0.0.0.0:9003 failed: port is already allocated
N chỉ run 1 cái a