Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu May 05, 2005 7:33 pm 
Offline
Junior Member
User avatar

Joined: Sun May 01, 2005 1:23 am
Posts: 31
Website: http://www.taupehat.com
Yahoo Messenger: pleasesendspamtothisaddess
As one of those beloved [host15] swap-thrashers, what can I do to avoid it? My node is pared down to the basics: apache, php, mysql, postfix, imap(cyrus), and amavis. That's what I need it for, and I'm not understanding why it thrashes so much. Apache is running some very light queries against the mysql backend and so is postfix. Nothing huge. I've got mysql tuned, apache down to 1 parent, etc etc. Have looked in the tuning thread, and don't see the magic bullet there either.


Top
   
PostPosted: Fri May 06, 2005 3:45 am 
Offline
Senior Member

Joined: Fri Aug 06, 2004 5:49 pm
Posts: 158
taupehat wrote:
My node is pared down to the basics: apache, php, mysql, postfix, imap(cyrus), and amavis


Assuming you have a Linode 64 (usually where the swap-thrashers are), that's a mouth-full. Putting a LAMP setup on a Linode 64 has always been pushing the limits... putting that aside, you also put on imap (tends to spawn some memory crunchers with lots of clients connecting), and the big one: amavis. Any mail filtering/scanning software eats away resources, no Linode 64 can handle a LAMP install alongside either spam filtering or virus scanning from what I've seen. I wouldn't even run your configuration on a Linode 96.

It's not hard to tell how your setup started thrashing. My apologies if you are in fact not on a 64 or 96, it had never been mentioned how much ram your configuration has, which is a rather important detail with your configuration.


Top
   
PostPosted: Fri May 06, 2005 10:19 am 
Offline
Senior Newbie

Joined: Thu Nov 11, 2004 12:05 pm
Posts: 12
You could change from Apache to something like lighttpd
You could move MySQL off of your site and subscribe to the (currently beta) MySQL VAS (Value Added Service) that is free right now http://www.linode.com/forums/viewtopic.php?t=1460

Those are two of the easiest things that you can DoRightNow(tm) to attempt to lower your overall memory usage. Though like tierra mentioned trying to do your own spam/av filtering is rough stuff especially on a L64.

adamg (the guy behind the MySQL VAS) has been working up a similar service for spam/av and quarantine but it's not ready to be in beta yet. But at least you know that these types of services are in the pipe getting ready to come down to you.


Top
   
 Post subject:
PostPosted: Sat May 07, 2005 1:46 am 
Offline
Senior Member
User avatar

Joined: Sat Jan 03, 2004 7:34 pm
Posts: 71
Website: http://www.darkforestmud.net
AOL: asura02003
Location: Oregon
When your system starts to swap like crazy, you should log on and run top, and find out which processes are using the most cpu time, swap space, memory, etc...

once you can pinpoint the culprit, it will be a lot easier to make it behave.


Top
   
 Post subject:
PostPosted: Sat May 07, 2005 8:58 am 
Offline
Senior Member

Joined: Mon Feb 28, 2005 7:21 pm
Posts: 76
It's been a while since I ran Cyrus, but you might find Courier-IMAP to be more lightweight.

A while ago I outsourced the spam and antivirus stuff to Tucows. It's been working fine (and it's cheap), and it would eliminate the biggest resource hog from your system.

Good luck!
Paul


Top
   
 Post subject:
PostPosted: Sun May 08, 2005 5:42 pm 
Offline
Junior Member
User avatar

Joined: Sun May 01, 2005 1:23 am
Posts: 31
Website: http://www.taupehat.com
Yahoo Messenger: pleasesendspamtothisaddess
Looks like I got it down to about 15 megs of swap on average. Took out amavis, and am relying on a good healthy set of RBLs to keep the spam down - and that's actually working pretty well.

Right now, mysql is by far and away the heaviest user of RAM on my system, starting at 14 megs, and gradually increasing. I try to restart it at least once a day, and have put in a request to see about that external server.

That said, this has proven to be an interesting experience. I'm beginning to come to the conclusion that 64 megs of ram isn't enough to do anything useful on a webserver. To me, a minimal server is LAMP + email. I can't imagine what a point of presense on the internet would be useful for with less.


Top
   
 Post subject:
PostPosted: Sun May 08, 2005 9:53 pm 
Offline
Senior Newbie

Joined: Thu Jan 27, 2005 9:59 pm
Posts: 10
I've got my 64 running quite well...

Mem: 59356k total, 48600k used, 10756k free, 7528k buffers
Swap: 263160k total, 5668k used, 257492k free, 21288k cached

Postfix, apache with php, pop3, mysql, named... etc...

I dunno, trim your configs.

-tiz


Top
   
 Post subject: Amavis
PostPosted: Thu Jul 21, 2005 12:18 am 
Offline
Junior Member

Joined: Mon Apr 26, 2004 5:03 pm
Posts: 47
Amavis was my main pain. I moved it off to another host and had postfix relay through it and everything got better.


Top
   
 Post subject:
PostPosted: Thu Jul 21, 2005 12:39 am 
Offline
Junior Member

Joined: Wed Aug 20, 2003 2:13 pm
Posts: 38
Website: http://www.kotalampi.com/
AOL: r1sto
Location: Hayward, CA
My biggest problem is spamd and heavy spam attacks. If there's heavy spam volume it also tends to use mysql (whitelist/bayes data in my config is in it) and takes the load up, iotokens down.

My solution has been to use the watchtokens.pl script I have created (see http://www.kotalampi.com/scripts/watchtokens ). It checks your available tokens and system load and if they reach critical levels (read the script), it runs the script /etc/rc.d/stop.sh and when things are back to normal, it runs /etc/rc.d/start.sh. It also creates stats to /var/adm/watchtokens.$DATE file (that rotates daily) and you can tail -f it to see what is going on.

In my stop.sh I block port 25 and all new connection requests. In start.sh I allow requests again. I have secondary MX so this has worked really well for me. This has proven out to be a good way to throttle the load and avoid iotokens to run totally out.

My stop.sh:
#!/bin/sh
/sbin/iptables -D INPUT -i eth0 -p tcp -m tcp --dport 25 -j ACCEPT

My start.sh:
#!/bin/sh
/sbin/iptables -A INPUT -i eth0 -p tcp -m tcp --dport 25 -j ACCEPT

The script can be started like this:
# /usr/local/bin/watchtokens.pl --sleep=15 --stop=yes &

Sleep option tells you how often you want to check iotokens, stop-option tells if you really want to run stop.sh/start.sh or just log the data.

Cheers,

Risto


Top
   
 Post subject:
PostPosted: Thu Jul 21, 2005 12:45 am 
Offline
Junior Member

Joined: Mon Apr 26, 2004 5:03 pm
Posts: 47
That URL seems to be broken.


Top
   
 Post subject:
PostPosted: Thu Jul 21, 2005 12:47 am 
Offline
Junior Member

Joined: Wed Aug 20, 2003 2:13 pm
Posts: 38
Website: http://www.kotalampi.com/
AOL: r1sto
Location: Hayward, CA
Yes, because it looks like phpBB added ').' to the end of the URL, let's try again: http://www.kotalampi.com/scripts/watchtokens


Top
   
 Post subject: My.cnf
PostPosted: Fri Jul 22, 2005 8:12 pm 
Offline
Senior Member

Joined: Sat Mar 19, 2005 3:29 pm
Posts: 50
Website: http://ryantate.com
Location: Berkeley, CA
RE your mysql memory usage, have you tried fiddling with /etc/my.cnf? If you are using innodb tables, the setting for innodb_buffer_pool_size can be quite important to overall RAM usage.


Top
   
 Post subject:
PostPosted: Fri Jul 22, 2005 8:22 pm 
Offline
Junior Member

Joined: Wed Aug 20, 2003 2:13 pm
Posts: 38
Website: http://www.kotalampi.com/
AOL: r1sto
Location: Hayward, CA
I'm not using innodb... it's such a disk hog. I have tuned up other variables in my.cnf though. Things like :

query-cache-type=1
query-cache-size=16M
key_buffer=128k
sort_buffer_size=256K
net_buffer_length=16K
thread_stack=256K

These might not be optimal but mysql isn't as big thrasher as spamd.

Risto


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group