Apache no responde a todas las solicitudes

Apache no responde a todas las solicitudes

Configuración: tengo alrededor de +1 millón de teléfonos que están llegando a mi servidor.

El servidor se ve bien. Mucha CPU y RAM: la CPU está inactiva aproximadamente el 90 % del tiempo (1)

La base de datos no recibe mucha carga: menos de 100 solicitudes por segundo (2).

Cuando accedo al servidor a través de un proxy Apache como "Android Lost", se agota el tiempo de espera.

Cuando accedo al servidor de aplicaciones directamente en el puerto 8080, recibo una respuesta de inmediato.

Lo que he hecho hasta ahora es:

  1. Reinicie todos los servicios, base de datos, apache, jetty
  2. Reinicié el servidor
  3. Intenté instalar nginx en lugar de apache (3)
  4. Intenté ejecutar Jetty en el puerto 80 y omitir Apache
  5. Intenté modificar la configuración del servidor (4)

A mí me parece como si una gran cantidad de solicitudes estuvieran intentando llegar al servidor, y en algún lugar hay un acelerador en Apache que debe configurarse.

Por lo tanto, cualquier sugerencia o sugerencia será muy apreciada.

Anuncio. 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   

Anuncio. 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

Anuncio. 3:

Del registro de errores de 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

Anuncio. 4:

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

Respuesta1

Esto se debe a que nginx no tiene suficientes conexiones de trabajo. Puedes verlo en el registro de errores de 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

La cantidad máxima de clientes que nginx puede atender se calcula con esta fórmula:

max_clients = worker_processes * worker_connections - keepalive connections

En nginx.confpuedes configurar la cantidad de worker_processesy worker_connections. Esto suele estar en el archivo de configuración principal en algún lugar de la parte superior (antes de httpla directiva):

worker_processes 1;
events {
    worker_connections 128
}

Lo más probable es que los tengas configurados. Recomiendo establecer worker_processesla cantidad de núcleos de CPU que tiene y aumentar el valor worker_connectionmientras verifica el rendimiento del servidor hasta que encuentre la cantidad que su servidor puede/necesita manejar.

información relacionada