OOMing

Hi,

My Linode is OOMing frequently.

I have followed the instructions as stated in "Troubleshooting Memory Issues" in the Linode Library but to no avail.

The culprit is Apache. How can I know what is causing the problem and the way to fix it ? Can someone update on this ASAP?

Thanks

Ravi

5 Replies

What size is your linode?

How are you running apache (prefork/worker?)

What is the contents of your apache configuration file?

Apache is running as prefork.

Size of the Linode is 16GB.

Contents of apache2.conf are as below :

#

Timeout: The number of seconds before receives and sends time out.

#

Timeout 300

#

KeepAlive: Whether or not to allow persistent connections (more than

one request per connection). Set to "Off" to deactivate.

#

KeepAlive On

#

MaxKeepAliveRequests: The maximum number of requests to allow

during a persistent connection. Set to 0 to allow an unlimited amount.

We recommend you leave this number high, for maximum performance.

#

MaxKeepAliveRequests 100

#

KeepAliveTimeout: Number of seconds to wait for the next request from the

same client on the same connection.

#

KeepAliveTimeout 15

#

Server-Pool Size Regulation (MPM specific)

#

prefork MPM

StartServers: number of server processes to start

MinSpareServers: minimum number of server processes which are kept spare

MaxSpareServers: maximum number of server processes which are kept spare

MaxClients: maximum number of server processes allowed to start

MaxRequestsPerChild: maximum number of requests a server process serves

StartServers 1

MinSpareServers 3

MaxSpareServers 6

MaxClients 24

MaxRequestsPerChild 3000

worker MPM

StartServers: initial number of server processes to start

MaxClients: maximum number of simultaneous client connections

MinSpareThreads: minimum number of worker threads which are kept spare

MaxSpareThreads: maximum number of worker threads which are kept spare

ThreadsPerChild: constant number of worker threads in each server process

MaxRequestsPerChild: maximum number of requests a server process serves

StartServers 2

MinSpareThreads 25

MaxSpareThreads 75

ThreadLimit 64

ThreadsPerChild 25

MaxClients 150

MaxRequestsPerChild 0

event MPM

StartServers: initial number of server processes to start

MaxClients: maximum number of simultaneous client connections

MinSpareThreads: minimum number of worker threads which are kept spare

MaxSpareThreads: maximum number of worker threads which are kept spare

ThreadsPerChild: constant number of worker threads in each server process

MaxRequestsPerChild: maximum number of requests a server process serves

StartServers 2

MaxClients 150

MinSpareThreads 25

MaxSpareThreads 75

ThreadLimit 64

ThreadsPerChild 25

MaxRequestsPerChild 0

These need to be set in /etc/apache2/envvars

User ${APACHERUNUSER}

Group ${APACHERUNGROUP}

Thanks

Ravi

edit````
StartServers 1 MinSpareServers 3 MaxSpareServers 6 MaxClients 24 MaxRequestsPerChild 3000

to look like

StartServers 1 MinSpareServers 1 MaxSpareServers 2 MaxClients 5 MaxRequestsPerChild 3000
````

That will keep apache to a maximum of 5 processes, assuming a process uses 40MB of ram that's 200MB out of your 512 it can use leaving plenty for other processes and caching.

As @obs said, try lowering MaxClients. But you might not need to push it all the way down to 5. 10 should be just fine unless you have a really problematic script (eg. a heavyweight WordPress plugin). Try various numbers and find the one that works best.

Also, change KeepAliveTimeout to something really low, like 2.

Thanks a lot. I guess the problem is resolved as I have not faced a problem till now.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct