Newbie help with apache/mysql

We have one site and run one forum (using Invision Power Board) on our 768 Linode. We upgraded from 512 because it was constantly running out of memory and we had to keep restarting the Linode up to 20 times a day.

Upgrading our memory has made no difference. I have attempted to follow the instructions in the low memory settings but this hasn't made any difference either.

We have on average around 20 users online at any given time, this has never risen above 50 users online at a time.

Here's what our top looks like, I don't really understand the ins and outs of what this is showing, but from what I can gather apache seems to be using 200mb, is that normal?

2152 mysql 20 0 330m 50m 6620 S 0 6.8 0:02.32 mysqld

2856 www-data 20 0 206m 19m 4008 S 0 2.7 0:01.12 apache2

2870 www-data 20 0 206m 19m 3648 S 0 2.6 0:00.39 apache2

2872 www-data 20 0 206m 19m 3660 S 0 2.6 0:00.24 apache2

2882 www-data 20 0 206m 19m 3676 S 0 2.6 0:00.40 apache2

2866 www-data 20 0 206m 19m 3632 S 0 2.6 0:00.27 apache2

2803 www-data 20 0 205m 18m 3692 S 0 2.5 0:00.71 apache2

2877 www-data 20 0 205m 18m 3652 S 0 2.5 0:00.41 apache2

2852 www-data 20 0 202m 16m 3972 S 0 2.2 0:01.00 apache2

2885 www-data 20 0 202m 15m 3576 S 0 2.1 0:00.34 apache2

2854 www-data 20 0 202m 15m 3696 S 0 2.1 0:00.82 apache2

2873 www-data 20 0 200m 13m 3664 S 6 1.9 0:00.65 apache2

2884 www-data 20 0 200m 13m 3652 S 0 1.8 0:00.42 apache2

2861 www-data 20 0 200m 13m 3660 S 0 1.8 0:00.88 apache2

2887 www-data 20 0 200m 13m 3568 S 0 1.8 0:00.35 apache2

2881 www-data 20 0 197m 10m 3888 S 0 1.5 0:00.65 apache2

2865 www-data 20 0 197m 10m 3648 S 0 1.4 0:00.22 apache2

2480 root 20 0 193m 10m 5068 S 0 1.4 0:00.57 apache2

2874 www-data 20 0 196m 10m 4008 S 0 1.4 0:01.11 apache2

2864 www-data 20 0 194m 6956 1076 S 0 0.9 0:00.06 apache2

2871 www-data 20 0 194m 6712 856 S 0 0.9 0:00.06 apache2

2875 www-data 20 0 194m 6712 856 S 0 0.9 0:00.05 apache2

2876 www-data 20 0 194m 6712 860 S 0 0.9 0:00.06 apache2

2879 www-data 20 0 194m 6712 860 S 0 0.9 0:00.05 apache2

2883 www-data 20 0 194m 6712 860 S 0 0.9 0:00.06 apache2

2886 www-data 20 0 194m 6712 860 S 0 0.9 0:00.05 apache2

Here is our my.cnf:

key_buffer = 192M

maxallowedpacket = 1M

thread_stack = 64K

threadcachesize = 8

This replaces the startup script and checks MyISAM tables if needed

the first time they are touched

myisam-recover = BACKUP

max_connections = 30

table_cache = 300

sort_buffer = 64K

netbufferlength = 2K

And apache2.conf:

StartServers 1

MinSpareServers 3

MaxSpareServers 6

ServerLimit 24

MaxClients 24

MaxRequestsPerChild 3000

Up until about a week ago everything was fine on the site, however we are running out of memory every day now and nothing has changed that I can see on the site (traffic hasn't really increased etc).

Has anyone got any tips as to what the problem could be? Bearing in mind I am quite new to Linode - this is a steep learning curve for me. I am beginning to wish I had gone for a managed solution now.

Thanks for any help you can give me :)

5 Replies

what apache modules do you have installed? It looks like you have a ton for apache to be that big.

Thanks for the reply :) I only installed Apache as per the linode beginner tutorial. These are the modules I have installed:

core_module (static)

logconfigmodule (static)

logio_module (static)

mpmpreforkmodule (static)

http_module (static)

so_module (static)

alias_module (shared)

authbasicmodule (shared)

authnfilemodule (shared)

authzdefaultmodule (shared)

authzgroupfilemodule (shared)

authzhostmodule (shared)

authzusermodule (shared)

autoindex_module (shared)

cgi_module (shared)

deflate_module (shared)

dir_module (shared)

env_module (shared)

mime_module (shared)

negotiation_module (shared)

php5_module (shared)

reqtimeout_module (shared)

setenvif_module (shared)

status_module (shared)

the 200mb per process you see is the virtual memory, but it's the resident that matters (in your measurment)

how many requests are you handling per second?

have you considered moving to apache2-mpm-worker + mod_fcgid (for php)? I found that combination to perform well (>100 req /sec) on a Linode 512 box (Apache2/PHP/PostgreSQL)

actually your max client is kinda low… so I don't see how you can be running out of memory on a linode 768… do you have 768Mb ram + 768Mb swap? are you running out of virtual memory and experiencing a kernel crash? services crash?

how much is mysql effectively using?

it seems like your website could run on a linode 256MB so I'm kinda surprised…

Maxclients is actually high, 768/24=32M per apache process, now I assume you have mysql on the same server so lets say you can give apache 50% of your ram that would be 16M per process, PHP has no problem chewing that up especially on a forum.

Try setting max clients to around 5 then increasing slowly if need be.

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