我们有一台规格为 8 vCore 和 16GB RAM 的服务器。在高峰期,服务器仅使用 15% 到 25% 的 CPU 和约 40% 的 RAM。
我们面临的问题是,一旦用户数量开始增加,Apache 的响应时间就会越来越长。有时甚至无法自动响应。
代理传递用于将 apache 连接到在特定端口上运行的节点应用程序。同时,当从 apache 获取响应存在延迟时,端口会在 ms 内给出响应。
例如当我使用 apache 时www.mydomainname.com/abc/endpoint我在 5 秒内得到响应。同时如果我使用www.mydomainname.com:3001/endpoint我在 30 毫秒内收到答复。
Apache 正在以以下配置在事件模式下运行。
<IfModule mpm_event_module>
StartServers 4
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestWorkers 800
ServerLimit 32
MaxConnectionsPerChild 10000
</IfModule>
KeepAlive On
MaxKeepAliveRequests 500
KeepAliveTimeout 3
站点配置如下:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerName mysite.ae
ServerAlias www.mysite.ae
ServerAdmin webmaster@localhost
DocumentRoot /var/www/mysite
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
SSLCertificateFile /etc/ssl/mysite/mysite.crt
SSLCertificateKeyFile /etc/ssl/mysite/mysite.key
ProxyPreserveHost off
ProxyReceiveBufferSize 2048
ProxyPass /e1/ https://127.0.0.1:4001/
ProxyPassReverse /e1/ https://127.0.0.1:4001/
ProxyPass /e2/ https://127.0.0.1:4002/
ProxyPassReverse /e2/ https://127.0.0.1:4002/
ProxyPass /e3/ https://127.0.0.1:4003/
ProxyPassReverse /e3/ https://127.0.0.1:4003/
ProxyPass /e4/ https://127.0.0.1:4004/
ProxyPassReverse /e4/ https://127.0.0.1:4004/
Alias /assets/ /var/www/e4/apis/
</VirtualHost>
</IfModule>
错误日志中有这个。
[proxy_http:error] [pid 7020:tid 140346369500864] [client 102.129.215.155:56380] AH01097: pass request body failed to 170.33.96.254:443 (wiocdsd.world) from 102.129.215.155 ()
[Mon Jun 12 12:25:36.000975 2023] [proxy:error] [pid 22976:tid 140345102825152] (20014)Internal error (specific information not available): [client 102.129.215.155:57246] AH01084: pass request body failed to 170.33.96.254:443 (wiocdsd.world)
[Mon Jun 12 12:25:36.001002 2023] [proxy:error] [pid 22976:tid 140345102825152] [client 102.129.215.155:57246] AH00898: Error during SSL Handshake with remote server returned by /api/index/getline
[Mon Jun 12 12:25:36.001007 2023] [proxy_http:error] [pid 22976:tid 140345102825152] [client 102.129.215.155:57246] AH01097: pass request body failed to 170.33.96.254:443 (wiocdsd.world) from 102.129.215.155 ()
[Mon Jun 12 12:25:36.131766 2023] [proxy:error] [pid 22905:tid 140346151388864] (20014)Internal error (specific information not available): [client 102.129.215.155:42064] AH01084: pass request body failed to 170.33.96.254:443 (wiocdsd.world)
什么地方可能出错了?