What could be causing the "process limit exceeded" error?

I launched the site about a week ago, and I sent an email message to the mailing list, in which I told everyone who was online. Immediately after that, the website crashed and the general error log was flooded with the "process limit exceeded" errors. Since then, I have tried to really clear a lot of code and minimize database connections. I will still see this error approximately once a day in the error log. What can cause this error? I tried to call the web host and they said that this had something to do with my code, but could not point me in any direction as to what was wrong with the code or on which page the error occurred. Can someone give me more info? How, for example, what is a process and how many processes should I have?

+4
source share
2 answers

Wow. The big question.

Obviously, you are maximizing your child apache workflows. To get a general idea of ​​how much you can create, use top to get the coarse memory from a single http process. If you use wordpress or other cms, it can be easily 50-100 meters each (if you use the php module for apache). Then, assuming that the machine is used only for web maintenance, take your shared memory, subtract a piece to use the OS, then divide it by 100 m (in this example). These are the maximum workflows you can have. Install it in your httpd.conf. As soon as you do this and restart apache, look at the top and make sure that you are not starting the memory swap. If you do this, you have set too many workers.

If there are any other things working as mysql servers, create space for this before calculating the number of workers you can have. If this number is small, it’s rude to quote the great man "you need a big boat." Just kidding. You can see really high memory for the http process, for example, more than 100 m. You can configure maximum requests per child below to shorten the life of the HTTP process. This can help clear bloated http workers.

Another area that needs attention is the response time to the request ... how long does each request take? For a quick check, use the firebug plugin for firefox and look at the "net" tab to see how long it takes for your initial request to respond (not images, etc.). If for some reason the request takes more than 1 or 2 seconds to respond, this is a big problem, since you are getting a kind of log jam. The reason for this may be the PHP code or mysql queries that take too long to respond. To solve this problem, make sure you use Wordpress to use some good caching plugin to reduce the load on mysql.

To be honest, unless you use memory with too few workers, optimizing your apache will not be easily eliminated in a short article without details on your server (memory, processor count, etc.) and your httpd.conf.

Note. If you do not have access to the server, it will be difficult for you to determine memory usage.

+1
source

The process limit is typically applied to shared web hosting providers and is usually related to the number of processes running on your account. Usually this will equal the number of connections made to your server right away (assuming that there is one PHP process per connection).

There are many factors that come into play. You should find out what this limit is at your hosting provider, and then find a new one that can handle your load.

0
source

Source: https://habr.com/ru/post/1441713/


All Articles