This topic describes the cause of and solution to the issue that the "apr_pollset_poll: The timeout specified has expired" error message appears when you use ApacheBench to perform a stress test on a Linux Elastic Compute Service (ECS) instance.
Problem description
When you run an ApacheBench command, such as ab -c 10 -n 5000 http://192.168.XXX.XXX/, to perform a stress test on a Linux ECS instance, the following error message appears:
apr_pollset_poll: The timeout specified has expiredCause
The number of concurrent stress test requests exceeds the maximum number of connections that can be established on the Linux ECS instance.
Solution
To resolve the preceding issue, you can log on to the Linux ECS instance, modify the kernel parameters file (/etc/sysctl.conf), and add the -koption to the ApacheBench test command.
Connect to the Linux ECS instance.
For more information, see Connection method overview.
Modify the kernel parameters file.
Run the following command to open the kernel parameters file (
/etc/sysctl.conf):vim /etc/sysctl.confAppend the following content to the kernel parameters file:
net.ipv4.netfilter.ip_conntrack_max = 3276800 net.ipv4.tcp_tw_recycle = 0 net.ipv4.tcp_tw_reuse = 0 net.ipv4.tcp_orphan_retries = 1 net.ipv4.tcp_fin_timeout = 25 net.ipv4.tcp_max_orphans = 8192 net.ipv4.ip_local_port_range = 32768 61000Press the
Esckey, enter:wq, and then press theEnterkey.
Run the following command for the changes to take effect:
sysctl -p /etc/sysctl.confAdd the
-koption to the ApacheBench test command and run the command to check whether the issue persists.In the following example, the
-koption is added to theab -c 10 -n 5000 http://192.168.XXX.XXX/command.ab -c 10 -n 5000 -k http://192.168.XXX.XXX/