我正在使用Apache Web服务器,我正在使用Apache基准测试(同时点击http请求的工具)测试我的应用程序。当我使用300个并发请求时它正在成功但是当它超过300时。很少有请求失败 SSL握手失败(5) 。据我所知,Apache Web服务器有256个请求限制,所以我将MaxRequestWorkers增加到1000仍然会因为少量请求而出现SSL握手失败错误。
有人可以检查一下这个配置,让我知道我的环境中的问题。
Apache服务器的配置:
1)httpd版本,
# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Oct 19 2017 20:39:16
2)我使用以下命令
检查了状态# systemctl status httpd -l
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2018-03-07 23:46:32 IST; 1min 55s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 4351 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Main PID: 4359 (httpd)
Status: "Total requests: 264; Current requests/sec: 0.1; Current traffic: 204 B/sec"
CGroup: /system.slice/httpd.service
├─4359 /usr/sbin/httpd -DFOREGROUND
├─4360 /usr/sbin/httpd -DFOREGROUND
├─4362 /usr/sbin/httpd -DFOREGROUND
├─5100 /usr/sbin/httpd -DFOREGROUND
├─5386 /usr/sbin/httpd -DFOREGROUND
├─5415 /usr/sbin/httpd -DFOREGROUND
└─5416 /usr/sbin/httpd -DFOREGROUND
3)由于httpd指向路径:/usr/lib/systemd/system/httpd.service
vi /usr/lib/systemd/system/httpd.service
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=man:httpd(8)
Documentation=man:apachectl(8)
[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/httpd
ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
ExecStop=/bin/kill -WINCH ${MAINPID}
# We want systemd to give httpd some time to finish gracefully, but still want
# it to kill httpd after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give
# httpd time to finish.
KillSignal=SIGCONT
PrivateTmp=true
[Install]
WantedBy=multi-user.target
4)根据上面的命令,我发现env文件可用' / etc / sysconfig / httpd'
vi /etc/sysconfig/httpd
#
# This file can be used to set additional environment variables for
# the httpd process, or pass additional options to the httpd
# executable.
#
# Note: With previous versions of httpd, the MPM could be changed by
# editing an "HTTPD" variable here. With the current version, that
# variable is now ignored. The MPM is a loadable module, and the
# choice of MPM can be changed by editing the configuration file
/etc/httpd/conf.modules.d/00-mpm.conf
#
#
# To pass additional options (for instance, -D definitions) to the
# httpd binary at startup, set OPTIONS here.
#
#OPTIONS=
#
# This setting ensures the httpd process is started in the "C" locale
# by default. (Some modules will not behave correctly if
# case-sensitive string comparisons are performed in a different
# locale.)
#
LANG=C
5)根据上面的命令,我发现conf文件可以在路径中找到:/etc/httpd/conf.modules.d/00-mpm.conf
vi /etc/httpd/conf.modules.d/00-mpm.conf
# Select the MPM module which should be used by uncommenting exactly
# one of the following LoadModule lines:
# prefork MPM: Implements a non-threaded, pre-forking web server
# See: http://httpd.apache.org/docs/2.4/mod/prefork.html
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
# worker MPM: Multi-Processing Module implementing a hybrid
# multi-threaded multi-process web server
# See: http://httpd.apache.org/docs/2.4/mod/worker.html
#
LoadModule mpm_worker_module modules/mod_mpm_worker.so
# event MPM: A variant of the worker MPM with the goal of consuming
# threads only for connections with active processing
# See: http://httpd.apache.org/docs/2.4/mod/event.html
#
#LoadModule mpm_event_module modules/mod_mpm_event.so
<IfModule mpm_worker_module>
ServerLimit 1000
MaxRequestWorkers 1000
</IfModule>
我的Apache配置有什么问题?为什么不提供1000个并发请求?如何在Apache Web服务器中实现更多并发请求?