On Wed, Jan 12, 2011 at 4:47 PM, Kaddeh <kad...@gmail.com> wrote:
> Jarry,
>
> Thanks for the monitoring advice, I am checking out monit right now.
>
> In terms of what is the root cause of the issue, I have narrowed it down to
> either write caching of a SQL cache issue.
>
> First, addressing the SQL issue and why I think that that could be one of
> the causes.  The entire site, for the most part is all in one giant DB
> (~9GB) a significant part of that is a 3gb table full of raw image data
> (yes, I know that this is a REALLY bad idea to do, but I didn't design the
> site, I just did a migration to off-site) that being said, there could be a
> problem with that.
>
> The write caching hteroy just comes up because I can clear the cached memory
> down to 14mb cached using 'sync && echo 3 > /proc/sys/vm/dump_cache'
>
> Cheers
>
> Kad
>
> On Wed, Jan 12, 2011 at 1:37 PM, Jarry <mr.ja...@gmail.com> wrote:
>>
>> On 12. 1. 2011 19:59, Kaddeh wrote:
>>
>>> P4 @ 3.0Ghz
>>> 2GB PC2 4200
>>> 2x 250GB drives in RAID1
>>> The system configurations are default for the most part with the server
>>> running MySQL and Apache.
>>> The problem that I am running into at this point, however is that the
>>> machine seems to run out of memory and will segfault either apache or
>>> mysql when does so, when apache segfaults, it is a recoverable error,
>>> when mysql does it, mysql can't recover short of restarting it.
>>> At this point, I have found a soft fix by running a cron job every 6
>>> hours or so to clear the cached memory, which seems to be the problem,
>>> however, I would like to find a more permanent fix to this issue.
>>
>> First of all, find what is causing that excessive memory usage.
>> I think 2GB should be enough for moderate web with apache+mysql.
>>
>> Second, use some monitoring software. Personally I'm using
>> "monit" and I am very satisfied with it. It can monitor processes
>> (if it is running, answering requests, etc), resources (disk,
>> memory, swap, cpu, i/o), files (content, permissions, checksums),
>> remote hosts (with some basic protocol checks i.e. http, ssh,
>> smtp, ftp, mysql, ntp, dns...), it can inform you about problems
>> (mail, log) and you can define rules what to do in case of anomalies
>> (i.e. if mysql is using to much memory, it will be restarted).
>>
>> It can start/restart processes if they die (happened to me once
>> with sshd on server which was ~50 miles away from me). You can
>> put monit in inittab, so in case monit itself dies it is restarted
>> automatically. Etc, etc.
>>
>> Jarry
>>
>> --
>> _______________________________________________________________
>> This mailbox accepts e-mails only from selected mailing-lists!
>> Everything else is considered to be spam and therefore deleted.
>>
>
>

So, a few questions:

What apache MPM are you using? You can control the number of processes
or threads in that file. The default is something like 200 processes
or threads (depending on MPM), so that could cause issues.

What does your my.cnf look like? MySQL makes it pretty easy to
regulate memory usage in my.cnf.

What sort of webapp is this, PHP, python, perl, ...?

That should be a good start.
Cheers
-- 
Matthew W. Summers

Reply via email to