All Products
Search
Document Center

:What do I do if the "apr_pollset_poll: The timeout specified has expired" error message appears when I use ApacheBench to perform a stress test on a Linux instance?

Last Updated:Nov 22, 2024

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 expired

Cause

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.

  1. Connect to the Linux ECS instance.

    For more information, see Connection method overview.

  2. Modify the kernel parameters file.

    1. Run the following command to open the kernel parameters file (/etc/sysctl.conf):

      vim /etc/sysctl.conf
    2. Append 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    61000
    3. Press the Esc key, enter :wq, and then press the Enter key.

  3. Run the following command for the changes to take effect:

    sysctl -p /etc/sysctl.conf
  4. Add the -k option to the ApacheBench test command and run the command to check whether the issue persists.

    In the following example, the -k option is added to the ab -c 10 -n 5000 http://192.168.XXX.XXX/ command.

    ab -c 10 -n 5000 -k http://192.168.XXX.XXX/