nginx和Mysql服务器负载限制(取决于服务器configuration)

我的服务器configuration是

Technology: Ivy Bridge Processor: Intel Xeon E3 1245v2 Intel Smart Cache: 8MB Cores: 4 Threads: 8 Frequency: 3.4GHz+ Turbo Boost: 3.8GHz Virtualization: yes RAM : 32 GB DDR3 Hard drive: Intel SSD 2 x 120GB RAID: SOFT - 0/1 (RAID-1 by default) NIC: GigaEthernet Bandwidth: 200 Mbps guaranteed Version: Parallels Plesk Panel v11.5.30_build115130819.13 os_CentOS 6 OS: CentOS 6.4 (Final) Server Soft: Apache \ PHP 

现在我需要知道我为Nginx设置了什么(设置最大值,这是我的服务器很好)

 worker_connections (what i set here); worker_processes (what i set here); 

MySQL的

 set-variable=max_connections= (what i set here) set-variable=max_user_connections= (what i set here) 

任何其他感谢MySQL,Nginx的和其他任何帮助我打开更多的负载请求告诉我,我真的需要帮助请帮助谢谢

最后,所有这些值都必须根据你要在你的Nginx和MySQL服务器上运行的内容来设置,所以没有银弹公式来回答你的问题,并且在每个可能的用例中都是正确的。 尽pipe如此,我还是试图把一些数据放在一起,这可能会导致你回答你的问题:

Nginx的

关于Nginx的worker_processes 文档说:

 If Nginx is doing CPU-intensive work such as SSL or gzipping and you have 2 or more CPUs/cores, then you may set worker_processes to be equal to the number of CPUs or cores. If you are serving a lot of static files and the total size of the files is bigger than the available memory, then you may increase worker_processes to fully utilize disk bandwidth. 

关于worker_connections ,请考虑我从这里得到的这个公式:

 max_clients = worker_processes * worker_connections 

因此,在知道了您的worker_processes值之后,您可以根据您可能需要提供的最大并发客户端数量来计算worker_connections

MySQL的

关于MySQL上的max_connections值,你应该在高峰时间试着找出你的MySQL需要多less个连接。 例如,如果您的应用程序在PHP上运行,并且您有32个PHP工作进程,并且PHP是唯一访问MySQL的应用程序,那么假设您在MySQL上不需要超过32个连接可能是安全的。 你也不想把这个值设得太高,因为每个连接都要分配一大堆缓冲区,所以如果max_connections值太高,你就冒着一些风险,通过创build连接来杀死你的MySQL直到内存耗尽。

max_user_connections基本上是一样的,只是在每个MySQL用户基础上,而不是整个MySQL服务器的全局值。

如果你还没有看过它,这里是相关的文档:

max_connections / max_user_connections