Apache不响应所有请求

安装程序:我有大约+100万个电话打到我的服务器。

服务器看起来不错。 大量的CPU和RAM – CPU在90%左右的闲置时间(1)

数据库没有得到太多的负载 – less于100秒的请求(2)。

当我通过一个像“Android丢失”的Apache代理服务器时,我得到一个超时。

当我直接在端口8080上打开应用程序服务器时,我立即得到答复。

我到目前为止所做的是:

  1. 重新启动所有服务,数据库,Apache,docker
  2. 重新启动服务器
  3. 试图安装nginx而不是Apache(3)
  4. 试图在端口80上运行Jetty并跳过Apache
  5. 试图调整服务器设置(4)

对我来说,这听起来像是一个巨大的请求负载试图击中服务器,并在某处有一个需要设置的Apache节stream。

所以,任何暗示或build议将不胜感激。

广告。 1:

top - 20:44:33 up 44 min, 2 users, load average: 2.44, 1.86, 2.80 Tasks: 165 total, 2 running, 163 sleeping, 0 stopped, 0 zombie Cpu(s): 1.0%us, 0.4%sy, 0.0%ni, 90.6%id, 7.5%wa, 0.0%hi, 0.5%si, 0.0%st Mem: 12296928k total, 12154152k used, 142776k free, 83228k buffers Swap: 6287292k total, 0k used, 6287292k free, 10461776k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 447 root 20 0 7587m 841m 14m S 9 7.0 0:39.81 java 1287 mongodb 20 0 120g 272m 247m S 3 2.3 1:38.12 mongod 10 root 20 0 0 0 0 S 0 0.0 0:07.57 rcu_sched 364 root 0 -20 0 0 0 S 0 0.0 0:00.96 kworker/0:1H 381 www-data 20 0 1966m 8188 2164 S 0 0.1 0:00.72 apache2 15562 root 20 0 7706m 105m 11m S 0 0.9 0:13.56 java 32636 www-data 20 0 1966m 8012 2236 S 0 0.1 0:00.72 apache2 

广告。 2:

 insert query update delete getmore command flushes mapped vsize res faults locked % idx miss % qr|qw ar|aw netIn netOut conn time 3 17 2 0 0 6 0 58.2g 120g 293m 11 1.7 0 0|0 0|0 3k 9k 43 20:49:40 11 46 8 0 0 24 0 58.2g 120g 295m 6 5.1 0 0|0 0|0 12k 21k 43 20:49:41 12 63 13 0 0 26 0 58.2g 120g 294m 3 1.3 0 0|0 0|0 17k 35k 43 20:49:42 5 45 6 0 0 12 0 58.2g 120g 296m 6 0.9 0 0|1 2|1 13k 22k 43 20:49:43 5 49 5 0 0 11 0 58.2g 120g 298m 5 0.1 0 0|0 0|0 13k 22k 

广告。 3:

来自nginx错误日志:

 2014/05/12 19:45:51 [alert] 9800#0: 768 worker_connections are not enough 2014/05/12 19:45:51 [alert] 9800#0: 768 worker_connections are not enough 2014/05/12 19:45:51 [alert] 9800#0: 768 worker_connections are not enough 2014/05/12 19:45:51 [alert] 9800#0: 768 worker_connections are not enough 2014/05/12 19:45:51 [alert] 9800#0: 768 worker_connections are not enough 2014/05/12 19:45:51 [alert] 9800#0: 768 worker_connections are not enough 2014/05/12 19:45:51 [alert] 9800#0: 768 worker_connections are not enough 2014/05/12 19:45:51 [alert] 9800#0: 768 worker_connections are not enough 2014/05/12 19:45:51 [alert] 9800#0: 768 worker_connections are not enough 

广告。 4:

 http://www.eclipse.org/jetty/documentation/current/high-load.html#d0e14090 

这是由于nginx没有足够的工作连接。 你可以在nginx错误日志中看到它:

 2014/05/12 19:45:51 [alert] 9800#0: 768 worker_connections are not enough 2014/05/12 19:45:51 [alert] 9800#0: 768 worker_connections are not enough 

nginx可以服务的客户端的最大数量是用下面的公式计算的:

max_clients = worker_processes * worker_connections - keepalive connections

nginx.conf你可以设置worker_processesworker_connections 。 这通常在主configuration文件的顶部(在http指令之前):

 worker_processes 1; events { worker_connections 128 } 

你很可能会有这些设置。 我build议将worker_processes设置为您拥有的cpu核心数量,并在检查服务器性能的同时增加worker_connection的值,直到find服务器可以/需要处理的数量。