The parameter of apache mpm-event cannot be adjusted. apachempm-event

Source: Internet
Author: User
Tags nginx reverse proxy

The parameter of apache mpm-event cannot be adjusted. apachempm-event

After several working modes of apache are introduced earlier, a series of problems may occur in parameter adjustment:

The httpd service cannot be started after/usr/local/apache/bin/apachectl-k start. The error log reports the following error:

[Fri May 08 08:21:00.903245 2015] [core:warn] [pid 29799:tid 140652774147840] AH00098: pid file /usr/local/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?[Fri May 08 08:21:00.913540 2015] [mpm_event:notice] [pid 29799:tid 140652774147840] AH00489: Apache/2.4.2 (Unix) PHP/5.4.1 mod_fcgid/2.3.6 configured -- resuming normal operations[Fri May 08 08:21:00.913605 2015] [core:notice] [pid 29799:tid 140652774147840] AH00094: Command line: '/usr/local/apache/bin/httpd'[Fri May 08 08:21:00.916519 2015] [mpm_event:alert] [pid 30514:tid 140652574951168] (11)Resource temporarily unavailable: apr_thread_create: unable to create worker thread[Fri May 08 08:21:00.916528 2015] [mpm_event:alert] [pid 30441:tid 140652574951168] (11)Resource temporarily unavailable: apr_thread_create: unable to create worker thread[Fri May 08 08:21:00.916537 2015] [mpm_event:alert] [pid 30311:tid 140652574951168] (11)Resource temporarily unavailable: apr_thread_create: unable to create worker threadError in my_thread_global_end(): 1 threads didn't exitError in my_thread_global_end(): 1 threads didn't exitError in my_thread_global_end(): 1 threads didn't exit


This is actually caused by two reasons:

1. system Kernel restriction, mainly for max user processes. The default value is 1024, which means to limit the maximum number of processes used by each user, if the limit is exceeded, even if the mpm parameter is set correctly, the httpd service cannot be started.

We set it through ulimit-u 102400.

For more information, see http://blog.yufeng.info/archives/2568.

If it is set to boot, you must first change/etc/security/limits. d/90-nproc.conf. In this file, nproc indicates a process and change it

* Soft nproc 102400

Then add ulimit-u 102400 to/etc/rc. local.

2. If some parameters are set incorrectly, the httpd server cannot be started. How to adjust them will be prompted in the error log.

Assuming that the kernel parameters are normal, let's take a runtime but warn mpm-event as an example:

#<IfModule mpm_event_module>#    ServerLimit                100#    StartServers         20#    MinSpareThreads        25 #   MaxSpareThreads      1200#    ThreadsPerChild      50 #    MaxRequestWorkers    2000 #    MaxConnectionsPerChild  10000 #</IfModule>
ThreadsPerChild is set to 64 by default. To modify ThreadLimit, you must stop apache and then start; otherwise, the configuration is invalid.

The parameter settings of MaxSpareThreads must be set according to StartServers * ThreadsPerChild = 1000. Therefore, MaxSpareThreads must be greater than 1000, where it is 1200. Otherwise, StartServers-MaxSpareThreads/ThreadsPerChild processes will be killed.

Set the parameters of MaxRequestWorkers according to ServerLimit * ThreadsPerChild = 5000. In this example, we set the parameter to 2000. A warning will be given after startup. We can change it to 5000 as prompted.


If we find that the server load is a little high, most of them are occupied by httpd, and we still have the remaining system resources, we need to change our parameters.


In addition, if our nginx reverse proxy is httpd, and httpd will wait in the queue due to high-load processing requests, this will cause nginx to return 502 bad gateway, in fact, this is because the backend server processing times out. We need to check our backend servers for solutions.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.