The server is configured with 2 cores and 4G 50m, how much concurrency can it hold?

do a fixed-time answer to split the bonus project, the server configuration is 2-core 4G 50M ok before the 10th. In the back, as soon as the time comes, I can"t get in. When I start on the 13th, it will collapse directly, the game page can be opened, but the ajax card is dead. Why do I open the background management platform to report 502 or 504? The following is the server status:

Nov.21,2021

how do you answer this question? how much you can carry is closely related to your backend program and nginx configuration. When the project cannot be opened, go to the server to see the cpu usage and load value. If the occupation is high, it means you need to optimize the program (such as adding cache), or upgrade the server configuration. Let the operation and maintenance staff take a look at load balance , elastic scaling and other things, which can be easily solved at a fixed time. The rush hour is not enough to bomb ecs . If you use the release, you can set the timing.


do you use the PHP at the back end to carry it?
look at the various loads, CPU, memory and bandwidth are not very high.
if the backend uses php-fpm, you can try to set the number of processes.

; php-fpm  static 
pm = dynamic
;
pm.max_children = 300
;
pm.start_servers = 20
;
pm.min_spare_servers = 5
;
pm.max_spare_servers = 35

;,php-fpm 
pm.max_requests = 1024

you can take a look at the corresponding configuration in your php-fpm.ini configuration file, optimize and adjust the above parameters to optimization.

in addition, do not perform time-consuming actions for PHP scripts to be optimized, especially by disabling functions such as sleep , usleep .


you can use auto scaling to create scaling groups and scaling rules, and automatically create a corresponding number of ECS instances according to the range of the average CPU utilization during business peak hours. For more information: use auto scaling to deal with business peak solutions

.
Menu