Gentoo Archives: gentoo-user

From: Kaddeh <kaddeh@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Web Server Memory Issues
Date: Wed, 12 Jan 2011 22:50:16
Message-Id: AANLkTimcS6x_e8VvhU=cNk2g3LgvZ-s8_9gGq2PL4TsH@mail.gmail.com
In Reply to: Re: [gentoo-user] Web Server Memory Issues by Jarry
1 Jarry,
2
3 Thanks for the monitoring advice, I am checking out monit right now.
4
5 In terms of what is the root cause of the issue, I have narrowed it down to
6 either write caching of a SQL cache issue.
7
8 First, addressing the SQL issue and why I think that that could be one of
9 the causes. The entire site, for the most part is all in one giant DB
10 (~9GB) a significant part of that is a 3gb table full of raw image data
11 (yes, I know that this is a REALLY bad idea to do, but I didn't design the
12 site, I just did a migration to off-site) that being said, there could be a
13 problem with that.
14
15 The write caching hteroy just comes up because I can clear the cached memory
16 down to 14mb cached using 'sync && echo 3 > /proc/sys/vm/dump_cache'
17
18 Cheers
19
20 Kad
21
22 On Wed, Jan 12, 2011 at 1:37 PM, Jarry <mr.jarry@×××××.com> wrote:
23
24 > On 12. 1. 2011 19:59, Kaddeh wrote:
25 >
26 > P4 @ 3.0Ghz
27 >> 2GB PC2 4200
28 >> 2x 250GB drives in RAID1
29 >> The system configurations are default for the most part with the server
30 >> running MySQL and Apache.
31 >> The problem that I am running into at this point, however is that the
32 >> machine seems to run out of memory and will segfault either apache or
33 >> mysql when does so, when apache segfaults, it is a recoverable error,
34 >> when mysql does it, mysql can't recover short of restarting it.
35 >> At this point, I have found a soft fix by running a cron job every 6
36 >> hours or so to clear the cached memory, which seems to be the problem,
37 >> however, I would like to find a more permanent fix to this issue.
38 >>
39 >
40 > First of all, find what is causing that excessive memory usage.
41 > I think 2GB should be enough for moderate web with apache+mysql.
42 >
43 > Second, use some monitoring software. Personally I'm using
44 > "monit" and I am very satisfied with it. It can monitor processes
45 > (if it is running, answering requests, etc), resources (disk,
46 > memory, swap, cpu, i/o), files (content, permissions, checksums),
47 > remote hosts (with some basic protocol checks i.e. http, ssh,
48 > smtp, ftp, mysql, ntp, dns...), it can inform you about problems
49 > (mail, log) and you can define rules what to do in case of anomalies
50 > (i.e. if mysql is using to much memory, it will be restarted).
51 >
52 > It can start/restart processes if they die (happened to me once
53 > with sshd on server which was ~50 miles away from me). You can
54 > put monit in inittab, so in case monit itself dies it is restarted
55 > automatically. Etc, etc.
56 >
57 > Jarry
58 >
59 > --
60 > _______________________________________________________________
61 > This mailbox accepts e-mails only from selected mailing-lists!
62 > Everything else is considered to be spam and therefore deleted.
63 >
64 >

Replies

Subject Author
Re: [gentoo-user] Web Server Memory Issues Matthew Summers <quantumsummers@g.o>
Re: [gentoo-user] Web Server Memory Issues Stroller <stroller@××××××××××××××××××.uk>