微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何增加Apache中的最大并发连接数?

我需要改变什么httpd conf设置来增加Apache的最大并发连接数? 注:我closures了KeepAlive,因为这主要是一个API服务器。

# # KeepAlive: Whether or not to allow persistent connections (more than # one request per connection). Set to "Off" to deactivate. # KeepAlive Off # # MaxKeepAliveRequests: The maximum number of requests to allow # during a persistent connection. Set to 0 to allow an unlimited amount. # We recommend you leave this number high,for maximum performance. # MaxKeepAliveRequests 100 # # KeepAliveTimeout: Number of seconds to wait for the next request from the # same client on the same connection. # KeepAliveTimeout 15 ## ## Server-Pool Size Regulation (MPM specific) ## # prefork MPM # StartServers: number of server processes to start # MinSpareServers: minimum number of server processes which are kept spare # MaxSpareServers: maximum number of server processes which are kept spare # ServerLimit: maximum value for MaxClients for the lifetime of the server # MaxClients: maximum number of server processes allowed to start # MaxRequestsPerChild: maximum number of requests a server process serves <IfModule prefork.c> StartServers 8 MinSpareServers 5 MaxSpareServers 20 ServerLimit 256 MaxClients 256 MaxRequestsPerChild 4000 </IfModule> # worker MPM # StartServers: initial number of server processes to start # MaxClients: maximum number of simultaneous client connections # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker threads which are kept spare # ThreadsPerChild: constant number of worker threads in each server process # MaxRequestsPerChild: maximum number of requests a server process serves <IfModule worker.c> StartServers 2 MaxClients 150 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 0 </IfModule>

Flask / Apache提交button进行file upload

REST API:使用Apache http web / content服务器Sinatra Passenger应用程序服务器

Nginx服务器上的Kirby CMS

Apache服务器的问题和大量的httpd进程

获得primefaces p:fileUpload在谷歌appengine下工作

以下是有关MaxClients和MaxRequestsPerChild计算的详细说明

http://web.archive.org/web/20160415001028/http://www.genericarticles.com/mediawiki/index.PHP?title=How_to_optimize_apache_web_server_for_maximum_concurrent_connections_or_increase_max_clients_in_apache

serverLimit 16 Startservers 2 MaxClients 200 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25

首先,每当apache启动时,它将启动2个由Startservers参数决定的子进程。 那么每个进程将启动由ThreadsPerChild参数确定的25个线程,所以这意味着2个进程只能服务50个并发连接/客户端,即25×2 = 50。 现在,如果有更多的并发用户来到,那么另一个子进程将启动,可以为另外25个用户提供服务。 但是可以启动多少个子进程由serverLimit参数控制,这意味着在上面的配置中,我总共可以有16个子进程,每个子进程可以处理25个线程,总共处理16×25 = 400个并发用户。 但是,如果在MaxClients定义的数字少于200,那么这意味着在8个子进程之后,由于我们已经定义了MaxClients的上限,所以不会有额外的进程启动。 这也意味着,如果我将MaxClients设置为1000,在16个子进程和400个连接之后,即使增加了MaxClient参数,也不会启动额外的进程,也不能为超过400个并发客户端提供服务。 在这种情况下,我们还需要将serverLimit增加到1000/25,即MaxClients/ThreadsPerChild=40因此,这是服务器1000客户端的优化配置

<Ifmodulee mpm_worker_module> serverLimit 40 Startservers 2 MaxClients 1000 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 0 </Ifmodulee>

更改MaxClients指令。 现在是256。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐