Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Wed Dec 09, 2009 8:29 pm 
Offline
Senior Member
User avatar

Joined: Tue Dec 01, 2009 10:31 pm
Posts: 57
Well, after some great pre-sales advice, I've set up my linode and am approaching judgement day when DNS will be moved across.

With our site activity peaking in recent weeks we've now outgrown dreamhost and they're killing php5 processes all over the place to "manage" the load, so I really need to move soon.

However, before that happens I'm keen for advice on tuning and load testing. My setup is CentOS 5.4 running Webmin and Virtualmin. This has eased the installation and setup of Apache, MySQL and PHP to power my Wordpress and smf instance.

Currently the linode is sitting there mostly idle, and it's got 113 processes running, does this seem like a lot? Additionally it is using 250MB ram and 143MB virtual ram... seems like a lot for an idle box. I've attached a screenshot of the status page.

Image

Quote:
ID Owner Started Command
1 root Dec08 init [3]
2 root Dec08 [migration/0]
3 root Dec08 [ksoftirqd/0]
4 root Dec08 [migration/1]
5 root Dec08 [ksoftirqd/1]
6 root Dec08 [migration/2]
7 root Dec08 [ksoftirqd/2]
8 root Dec08 [migration/3]
9 root Dec08 [ksoftirqd/3]
10 root Dec08 [events/0]
11 root Dec08 [events/1]
12 root Dec08 [events/2]
13 root Dec08 [events/3]
14 root Dec08 [khelper]
15 root Dec08 [kthread]
17 root Dec08 [xenwatch]
18 root Dec08 [xenbus]
27 root Dec08 [kblockd/0]
28 root Dec08 [kblockd/1]
29 root Dec08 [kblockd/2]
30 root Dec08 [kblockd/3]
31 root Dec08 [cqueue/0]
32 root Dec08 [cqueue/1]
33 root Dec08 [cqueue/2]
34 root Dec08 [cqueue/3]
36 root Dec08 [kseriod]
120 root Dec08 [pdflush]
121 root Dec08 [pdflush]
122 root Dec08 [kswapd0]
123 root Dec08 [aio/0]
124 root Dec08 [aio/1]
125 root Dec08 [aio/2]
126 root Dec08 [aio/3]
128 root Dec08 [jfsIO]
129 root Dec08 [jfsCommit]
130 root Dec08 [jfsCommit]
131 root Dec08 [jfsCommit]
132 root Dec08 [jfsCommit]
133 root Dec08 [jfsSync]
134 root Dec08 [xfslogd/0]
135 root Dec08 [xfslogd/1]
136 root Dec08 [xfslogd/2]
137 root Dec08 [xfslogd/3]
138 root Dec08 [xfsdatad/0]
139 root Dec08 [xfsdatad/1]
140 root Dec08 [xfsdatad/2]
141 root Dec08 [xfsdatad/3]
750 root Dec08 [net_accel/0]
751 root Dec08 [net_accel/1]
752 root Dec08 [net_accel/2]
753 root Dec08 [net_accel/3]
761 root Dec08 [kpsmoused]
764 root Dec08 [kcryptd/0]
765 root Dec08 [kcryptd/1]
766 root Dec08 [kcryptd/2]
767 root Dec08 [kcryptd/3]
768 root Dec08 [kmirrord]
777 root Dec08 [kjournald]
802 root Dec08 [kauditd]
835 root Dec08 /sbin/udevd -d
1172 root 09:48 /usr/sbin/httpd
1174 apache 09:48 /usr/sbin/httpd
1175 apache 09:48 /usr/sbin/httpd
1176 apache 09:48 /usr/sbin/httpd
1177 apache 09:48 /usr/sbin/httpd
1178 apache 09:48 /usr/sbin/httpd
1179 apache 09:48 /usr/sbin/httpd
1180 apache 09:48 /usr/sbin/httpd
1181 apache 09:48 /usr/sbin/httpd
1182 apache 09:48 /usr/sbin/httpd
1214 apache 09:49 /usr/sbin/httpd
1812 apache 10:34 /usr/sbin/httpd
1816 apache 10:34 /usr/sbin/httpd
1817 apache 10:34 /usr/sbin/httpd
2151 root Dec08 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient-eth0.leases -pf /var/run/dhc ...
2189 root Dec08 syslogd -m 0
2192 root Dec08 klogd -x
2214 named Dec08 /usr/sbin/named -u named
2233 dbus Dec08 dbus-daemon --system
2266 root Dec08 /usr/sbin/sshd
32007 root 08:12 sshd: root@pts/0
32009 root 08:12 -bash
2301 root Dec08 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/my ...
2351 mysql Dec08 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-f ...
2418 root Dec08 /usr/libexec/postfix/master
341 postfix 09:09 pickup -l -t fifo -u
2423 postfix Dec08 qmgr -l -t fifo -u
2430 nobody Dec08 proftpd: (accepting connections)
2451 root Dec08 crond
32675 root 09:00 crond
32680 root 09:00 /bin/bash /usr/share/clamav/freshclam-sleep
32686 root 09:00 sleep 10493
2459 root Dec08 /usr/sbin/saslauthd -m /var/run/saslauthd -a pam
2460 root Dec08 /usr/sbin/saslauthd -m /var/run/saslauthd -a pam
2462 root Dec08 /usr/sbin/saslauthd -m /var/run/saslauthd -a pam
2463 root Dec08 /usr/sbin/saslauthd -m /var/run/saslauthd -a pam
2464 root Dec08 /usr/sbin/saslauthd -m /var/run/saslauthd -a pam
2479 mailman Dec08 /usr/bin/python /usr/lib/mailman/bin/mailmanctl -s -q start
2488 mailman Dec08 /usr/bin/python /usr/lib/mailman/bin/qrunner --runner=ArchRunner:0:1 -s
2489 mailman Dec08 /usr/bin/python /usr/lib/mailman/bin/qrunner --runner=BounceRunner:0:1 -s
2490 mailman Dec08 /usr/bin/python /usr/lib/mailman/bin/qrunner --runner=CommandRunner:0:1 -s
2491 mailman Dec08 /usr/bin/python /usr/lib/mailman/bin/qrunner --runner=IncomingRunner:0:1 -s
2492 mailman Dec08 /usr/bin/python /usr/lib/mailman/bin/qrunner --runner=NewsRunner:0:1 -s
2493 mailman Dec08 /usr/bin/python /usr/lib/mailman/bin/qrunner --runner=OutgoingRunner:0:1 -s
2494 mailman Dec08 /usr/bin/python /usr/lib/mailman/bin/qrunner --runner=VirginRunner:0:1 -s
2495 mailman Dec08 /usr/bin/python /usr/lib/mailman/bin/qrunner --runner=RetryRunner:0:1 -s
2496 root Dec08 /usr/bin/perl /usr/libexec/usermin/miniserv.pl /etc/usermin/miniserv.conf
2501 root Dec08 /usr/bin/perl /usr/libexec/webmin/miniserv.pl /etc/webmin/miniserv.conf
1958 root 10:43 /usr/libexec/webmin/proc/index_tree.cgi
2504 root Dec08 /sbin/mingetty tty1


I note that mailman is running but I have no requirement for mail from this server. I can kill the process but it just comes back after a reboot.

Any advice would be most appreciated, I plan to get some users to do a load test this evening.

Btw I'm running the wp-super cache and the node url is temporarily http://www.sehwagology.com/

Cheers,
Moses.


Top
   
 Post subject:
PostPosted: Wed Dec 09, 2009 9:10 pm 
Offline
Senior Member

Joined: Mon Dec 07, 2009 6:46 am
Posts: 331
Yes, that's a lot. I don't know what of that is default on CentOS and what is autostarted or required by Webmin.

But if you don't need (sending/receiving) mail, then you should deactivate postfix and especially clamav which is a resource hog (well, at least if used through amavis). If I'm not mistaken you also don't need saslauth and I'm guessing mailman. Although, I don't know if CentOS requires active postfix for local notifications delivery? Also, I don't know Linode's CentOS image, but afaik "vanilla" CentOS installation comes with a lot of unnecessary thingies like bluetooth etc... Oh, and you don't really need Bind (named).

Unless, as I said, it is all required by Webmin, and iirc it is.

Just for comparison, my Gentoo node hosting a few low traffic sites (up to a hundred thousand hits per month and a few thousand email transactions, in total) on lighttpd, php (3 processes per site), postgresql, postfix, dovecot, spamassassin, vsftpd, ssh, memcached, rarely exceeds 100MB (and then only due spamd bloat). Upon boot, memory usage is around 70MB.

Because Apache is a hog an IMHO should be avoided unless you require modules not available under other webservers, or per directory .htaccess (in short, if you're not providing a shared hosting service), and Webmin may be cute clicky-clicky config-fest but in two years of my experience in running a VPS, I never really needed it. It is maybe useful for administering a number of domains, if cPanel is too expensive.

I prefer gentoo, install only what I need, configure it per my liking and call it a day. I have my own set of tools and scripts for easy administration and ready-made config files for services that I use.

But that's me. YMMV. :wink:


Top
   
 Post subject:
PostPosted: Wed Dec 09, 2009 9:15 pm 
Offline
Senior Member

Joined: Thu Dec 04, 2008 10:55 am
Posts: 57
Location: New Jersey
Apache is pwning your memory usage as said above. Limit your httpd server load via httpd.conf depending on how much you think is necessary.


Top
   
 Post subject:
PostPosted: Wed Dec 09, 2009 9:52 pm 
Offline
Senior Member
User avatar

Joined: Tue Dec 01, 2009 10:31 pm
Posts: 57
Thanks for the informative and timely advice,

That comparison is very interesting, it's good to hear real world numbers on the resources that a well tuned site will require. Alas, I'm new to VPS hosting and my site is not overly busy (around 3000 hits to the blog and 6000 hits to the forum per day).

I went with webmin as the clicky admin interface is great for my sanity as I learn linux, and I'm hoping performance will be sustainable for the short to medium term with the current setup. By the time I get my head around the full barebones power of a VPS and then switch over to an optimised instance.

Given these traffic estimates (actually they're our busiest days on record), if I disable/uninstall clamav, postfix, Bind, saslauth, and mailman, then tell apache behave would this be a viable platform for my needs?

I don't know if I really require Apache, though I do need mod_rewrite to run the permalinks in wordpress. Should I be looking to a lighter web server from the start, or perhaps make that the first thing to optimise when performance suffers.

Finally, are there any quick pointers on how to remove the bloatware?

Cheers,
Moses.


Top
   
 Post subject:
PostPosted: Wed Dec 09, 2009 10:12 pm 
Offline
Senior Member
User avatar

Joined: Tue Dec 01, 2009 10:31 pm
Posts: 57
I just found Webmin's startup options page, seems I can disable many of these from this screen

Image

For now I've disabled mailman, named (BIND) and saslauthd. Any others I can get rid of?


Top
   
 Post subject:
PostPosted: Wed Dec 09, 2009 10:30 pm 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
There's a decent chance that tool is "pulling your leg" with regards memory usage... the best way to check it is to ssh in and use the "free" command:

Code:
$ free -m
             total       used       free     shared    buffers     cached
Mem:           348        333         15          0          3        219
-/+ buffers/cache:        109        238
Swap:          127         26        101


On the "Mem:" line, it says I'm using 333MB of RAM... however, if you look at the line after that (which subtracts cached stuff), I'm only using 109MB! For some odd reason, most tools that display memory usage like to display the heart-attack total. I believe this is a vast conspiracy by memory manufacturers, but I digress.

This page has a good explanation of the whole thing: http://www.linuxatemyram.com/


Top
   
 Post subject:
PostPosted: Wed Dec 09, 2009 10:33 pm 
Offline
Senior Member
User avatar

Joined: Tue Dec 01, 2009 10:31 pm
Posts: 57
Just disabled the above startup processes and applied these two changes
Quote:
Two tweaks to reduce memory consumption:

1) If not needed, disable innodb and berkley database by adding the following code to /etc/my.cnf in the [mysqld] section and reboot mysql

skip-innodb
skip-bdb


2) Reduce Apache's memory usage by adding the following to httpd.conf

MaxSpareServers 1
MinSpareServers 1
StartServers 1


Webmin now reports that 86.08MB RAM is now being used ;)


Last edited by Moses on Wed Dec 09, 2009 10:38 pm, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Wed Dec 09, 2009 10:36 pm 
Offline
Senior Member
User avatar

Joined: Tue Dec 01, 2009 10:31 pm
Posts: 57
Thanks hoopycat, the free command reports

Quote:
> free -m
total used free shared buffers cached
Mem: 360 177 182 0 7 81
-/+ buffers/cache: 89 271
Swap: 511 0 511


Top
   
 Post subject:
PostPosted: Wed Dec 09, 2009 11:02 pm 
Offline
Senior Newbie

Joined: Wed May 06, 2009 2:49 pm
Posts: 19
Moses wrote:
For now I've disabled mailman, named (BIND) and saslauthd. Any others I can get rid of?


I'm running CentOS 5.3, and have these services enabled:

Code:
$ chkconfig --list | grep 3:on
atd               0:off   1:off   2:off   3:on   4:on   5:on   6:off
auditd            0:off   1:off   2:on   3:on   4:on   5:on   6:off
crond             0:off   1:off   2:on   3:on   4:on   5:on   6:off
haldaemon         0:off   1:off   2:off   3:on   4:on   5:on   6:off
httpd             0:off   1:off   2:on   3:on   4:on   5:on   6:off
ip6tables         0:off   1:off   2:on   3:on   4:on   5:on   6:off
iptables          0:off   1:off   2:on   3:on   4:on   5:on   6:off
irqbalance        0:off   1:off   2:on   3:on   4:on   5:on   6:off
kudzu             0:off   1:off   2:off   3:on   4:on   5:on   6:off
mcstrans          0:off   1:off   2:on   3:on   4:on   5:on   6:off
mdmonitor         0:off   1:off   2:on   3:on   4:on   5:on   6:off
messagebus        0:off   1:off   2:off   3:on   4:on   5:on   6:off
microcode_ctl     0:off   1:off   2:on   3:on   4:on   5:on   6:off
mysqld            0:off   1:off   2:on   3:on   4:on   5:on   6:off
named             0:off   1:off   2:on   3:on   4:on   5:on   6:off
network           0:off   1:off   2:on   3:on   4:on   5:on   6:off
readahead_early   0:off   1:off   2:on   3:on   4:on   5:on   6:off
restorecond       0:off   1:off   2:on   3:on   4:on   5:on   6:off
sendmail          0:off   1:off   2:on   3:on   4:on   5:on   6:off
sshd              0:off   1:off   2:on   3:on   4:on   5:on   6:off
syslog            0:off   1:off   2:on   3:on   4:on   5:on   6:off
vsftpd            0:off   1:off   2:on   3:on   4:on   5:on   6:off
xinetd            0:off   1:off   2:on   3:on   4:on   5:on   6:off


And it's only taking about 100MB memory:

Code:
$ free
             total       used       free     shared    buffers     cached
Mem:        553180     491648      61532          0      58404     332188
-/+ buffers/cache:     101056     452124
Swap:       393208         32     393176


And, I could probably turn off several of those, as they aren't doing anything useful.

Basically, what you can do, is search to find out what each of those services do that are running on your VPS. If you don't need them, then turn them off.

I'm guessing, based on what you've said, that you may not need these: clamd-wrapper, named, netfs, postfix, proftpd.

And, as far as I know, these aren't useful on the VPS: lm_sensors, lvm2-monitor, rawdevices


Top
   
 Post subject:
PostPosted: Wed Dec 09, 2009 11:33 pm 
Offline
Senior Member
User avatar

Joined: Tue Dec 01, 2009 10:31 pm
Posts: 57
Thanks Kipbond,
I've removed those from the startup list with the exception of proftpd which I believe I use for transferring files to/from the VPS. When the system is running and stable I guess I could turn it off and only switch it on when I have files to transfer...
Strangely enough memory usage has now gone up to 125MB!
Will reboot and see how it comes back up...


Top
   
 Post subject:
PostPosted: Wed Dec 09, 2009 11:38 pm 
Offline
Senior Newbie

Joined: Wed May 06, 2009 2:49 pm
Posts: 19
You could/should use sftp to transfer files (which will use ssh). It's more secure, and then it's one less service to run on the server.


Top
   
 Post subject:
PostPosted: Wed Dec 09, 2009 11:39 pm 
Offline
Senior Member
User avatar

Joined: Tue Dec 01, 2009 10:31 pm
Posts: 57
Cheers, I am using sftp.. didn't realise it was a different process though.... proftpd is off ;)


Top
   
 Post subject:
PostPosted: Wed Dec 09, 2009 11:45 pm 
Offline
Senior Newbie

Joined: Wed May 06, 2009 2:49 pm
Posts: 19
You can use "top" to get a better view of what is using your memory. Apache may start with only 1-2 processes (if you configured it that way), but then as you get more connections, it starts new processes. I'm not sure if Wordpress works with them, but you might check into using Lighttpd or Nginx if Apache ends up proving to be too much of a memory hog for you.


Top
   
 Post subject:
PostPosted: Thu Dec 10, 2009 12:16 am 
Offline
Senior Member
User avatar

Joined: Tue Dec 01, 2009 10:31 pm
Posts: 57
Thanks again KipBond,
The system is running on a much smaller footprint now, around 120MB seems the norm.

I'll get some users on it tonight for some load testing. Anything I should monitor during the load testing? Linode monitors CPU/Network/IO for me, I guess I shoudl run a few top's through the testing window to see where the RAM is being used..... anything else to have a play with?

I'm thinking I should set Apache to be more in tune with the requirements, currently I have set

Quote:
<IfModule prefork.c>
MaxSpareServers 3
MinSpareServers 1
StartServers 1
ServerLimit 50
MaxClients 50
MaxRequestsPerChild 2000

<IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>


and I just turned off most of the modules as follows:
Quote:
#LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authn_alias_module modules/mod_authn_alias.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
#LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
#LoadModule authz_user_module modules/mod_authz_user.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
#LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
#LoadModule authz_default_module modules/mod_authz_default.so
#LoadModule ldap_module modules/mod_ldap.so
#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
#LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule logio_module modules/mod_logio.so
#LoadModule env_module modules/mod_env.so
#LoadModule ext_filter_module modules/mod_ext_filter.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
#LoadModule usertrack_module modules/mod_usertrack.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule info_module modules/mod_info.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
#LoadModule actions_module modules/mod_actions.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule cache_module modules/mod_cache.so
#LoadModule suexec_module modules/mod_suexec.so
#LoadModule disk_cache_module modules/mod_disk_cache.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule mem_cache_module modules/mod_mem_cache.so
#LoadModule cgi_module modules/mod_cgi.so
#LoadModule version_module modules/mod_version.so


Top
   
 Post subject:
PostPosted: Thu Dec 10, 2009 12:17 am 
Offline
Senior Member

Joined: Sun Aug 31, 2008 4:29 pm
Posts: 177
Webmin can be configured to work with the services you want, the way you want. It doesn't really "need" much of anything, doesn't install anything and doesn't autostart anything unless you configure it to do so. That's it's beauty compared to the "my way or no way" panels like cPanel.

I have a Linode 540 with CentOS 5, Webmin+Virtual, Apache, MySQL, Postfix, Dovecot, etc. It hosts around 30 domains and maybe 60 email users. Memory usage is 100-125 MB.

I'd suggest you...

- Disable the services you don't need. If you're not sure what they do, read up on them or ask. e.g., Mailman definitely can go, and Bind also if you're going to use Linode's DNS manager.

- Look into MySQL memory optimization. There is likely a big saving you can realize there.

- By all means restrict Apache, but don't strangle the poor thing. Your sites will be happier with more than one Apache process running. Try setting those *Servers settings in the 3-6 range and set an upper limit (MaxClients) to maybe 20. Then monitor and see how things go.


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


Who is online

Users browsing this forum: No registered users and 3 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