Current time: 04-27-2024, 05:49 AM Hello There, Guest! (LoginRegister)


Post Reply 
Running ISPCP on a low resources system
Author Message
Daff Offline
Junior Member
*

Posts: 37
Joined: Oct 2006
Reputation: 0
Post: #1
Running ISPCP on a low resources system
Becaus of this thread telling about the huge memory usage of an ISPCP installation (which is about 640 Megabytes) on a virtual private server (VPS) I was searching for some optimization possibilities. Virtuozzo or OpenVZ (which is basically the same but less expensive Wink based virtual servers don't use a real swap file they only provide, besides the warranted RAM, a burstable RAM (which is swapped on the hardware node so try not to exceed your warranted RAM). If an application exceeds the burstable RAM value it simply won't start.

1. Configure apache worker MPM for low memory usage

On most Systems Apache consumes most memory (in the basic configuration on my System about 480 MB RAM).
So we have to change the MPM workers to a lower value:

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
StartServers 1
MaxClients 100
MinSpareThreads 1
MaxSpareThreads 50
ThreadsPerChild 10
MaxRequestsPerChild 5000
</IfModule>

That suggestion was partly taken from http://wiki.vpslink.com/index.php?title=...igurations I don't know if its a usefull configuration, hope somebody is willing to test iit, too.
Another value I found important is the default thread stack size (which is 8 Megabytes). I really don't know how much of it is really used by an apache Thread. Here somebody tells about 1 Megabyte but I think its a bit too less. Actually I use this one (just add it at the end of you /etc/apache2/apache2.conf):

ThreadStackSize 4000000

After every change you have to call
$ /etc/init.d/apache2 force-reload


2. Configure MySQL

Again taken from this Wiki a my.cnf configuration to make MySQL less RAM intensive.
I used some of the values and changed this parts in the /etc/mysql/my.cnf file:

#
# * Fine Tuning
#
key_buffer = 1M
max_allowed_packet = 8M
thread_stack = 64K
thread_cache_size = 8
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 8M

3. Stop unnessesary memory intensive services

Bind is mostly never used and consumes (about 40 MBs of memory:
/etc/init.d/bind9 stop
TODO: Don't start bind on startup HowTO (just delete /etc/init.d/bind9?)

Stop the greylisting (about 20MB)
/etc/init.d/postgrey stop
According to this FAQ entry:
http://www.isp-control.net/component/opt...iew/id,15/

You just have to uncomment this configuration line. But won't the /etc/init.d/postgrey still be started (TODO)?

All that stuff together has, on my Test VPS, decreased memory usage from about 640 MB to about 200 Megabytes.

Please try it and tell me if you've gotten any problems or think some of this configuration is useless or stupid!
(This post was last modified: 05-27-2007 04:52 AM by Daff.)
05-27-2007 04:50 AM
Visit this user's website Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #2
RE: Running ISPCP on a low resources system
Daff Wrote:Becaus of this thread telling about the huge memory usage of an ISPCP installation (which is about 640 Megabytes) on a virtual private server (VPS) I was searching for some optimization possibilities. Virtuozzo or OpenVZ (which is basically the same but less expensive Wink based virtual servers don't use a real swap file they only provide, besides the warranted RAM, a burstable RAM (which is swapped on the hardware node so try not to exceed your warranted RAM). If an application exceeds the burstable RAM value it simply won't start.

1. Configure apache worker MPM for low memory usage

On most Systems Apache consumes most memory (in the basic configuration on my System about 480 MB RAM).
So we have to change the MPM workers to a lower value:

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
StartServers 1
MaxClients 100
MinSpareThreads 1
MaxSpareThreads 50
ThreadsPerChild 10
MaxRequestsPerChild 5000
</IfModule>

That suggestion was partly taken from http://wiki.vpslink.com/index.php?title=...igurations I don't know if its a usefull configuration, hope somebody is willing to test iit, too.
Another value I found important is the default thread stack size (which is 8 Megabytes). I really don't know how much of it is really used by an apache Thread. Here somebody tells about 1 Megabyte but I think its a bit too less. Actually I use this one (just add it at the end of you /etc/apache2/apache2.conf):

ThreadStackSize 4000000

After every change you have to call
$ /etc/init.d/apache2 force-reload

This modification works perfect. Apache2 needs about ~80-100MB.
05-27-2007 08:08 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Daff Offline
Junior Member
*

Posts: 37
Joined: Oct 2006
Reputation: 0
Post: #3
RE: Running ISPCP on a low resources system
Great. I don't know if the number of clients is enough. There is an apache load tester (e.g. simulate 1000 silmutaneous requests) but I've forgotten where.

Do you know something about the auto start programs bind9 and postgrey?
05-27-2007 09:48 PM
Visit this user's website Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #4
RE: Running ISPCP on a low resources system
Do you mean "ab" Apache Benchmark ? (http://httpd.apache.org/docs/1.3/programs/ab.html)

What do you want to know about the autostart ?
05-27-2007 11:33 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Daff Offline
Junior Member
*

Posts: 37
Joined: Oct 2006
Reputation: 0
Post: #5
RE: Running ISPCP on a low resources system
Ok, got it. I disabled Bind9 and Postgrey with rcconf. Now I'm down to 180 Megabytes. Hope it'll work as it is supposed to.
05-28-2007 12:50 AM
Visit this user's website Find all posts by this user Quote this message in a reply
raphael Offline
Member
***

Posts: 474
Joined: Apr 2007
Reputation: 8
Post: #6
RE: Running ISPCP on a low resources system
Daff Wrote:Bind is mostly never used and consumes (about 40 MBs of memory:
/etc/init.d/bind9 stop
I don't recommend stopping bind as some servers may need to resolve addresses (specially localy-owned ones) and make the changes take effect ASAP.
Daff Wrote:TODO: Don't start bind on startup HowTO (just delete /etc/init.d/bind9?)
Usually servers run at runlevel 2, which means that deleting /etc/rc2.d/S15bind9 will do the trick.

Also, if clamd and clamav-milter are both being used, make sure to tell clamav-milter to use clamd instead of loading the whole engine+database on it's one.
05-28-2007 08:50 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Daff Offline
Junior Member
*

Posts: 37
Joined: Oct 2006
Reputation: 0
Post: #7
RE: Running ISPCP on a low resources system
Quote:I don't recommend stopping bind as some servers may need to resolve addresses (specially localy-owned ones) and make the changes take effect ASAP.

Hm do you think? OpenVZ writes the externally assigned nameserver (which handles my DNS) to the resolv.conf (thats the reason why you must not modify a resolv.conf on a VPS) every startup. The local addresses which point to localhost are stored in the /etc/hosts. What addresses could be left?
05-28-2007 09:16 AM
Visit this user's website Find all posts by this user Quote this message in a reply
raphael Offline
Member
***

Posts: 474
Joined: Apr 2007
Reputation: 8
Post: #8
RE: Running ISPCP on a low resources system
Well, not all the servers are VPS', and not all the VPS' are OpenVZ; so don't make that kind of assumption. I can tell you that virtuozzo doesn't modify /etc/resolv.conf.
So you now know what addresses could be left Wink
05-28-2007 10:01 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Daff Offline
Junior Member
*

Posts: 37
Joined: Oct 2006
Reputation: 0
Post: #9
RE: Running ISPCP on a low resources system
Sorry I have to disagree, because Virtuozzo is OpenVZ.
Look here:
http://en.wikipedia.org/wiki/OpenVZ

Quote:OpenVZ is a basis of Virtuozzo, a proprietary software product provided by SWsoft, Inc. OpenVZ is licensed under the GPL version 2.

But I know what you mean. So as long I have my external nameserver in the resolv.conf and the local domains in the hosts file there should be no problems (hope I won't run in trouble somewhere Wink?
05-28-2007 09:37 PM
Visit this user's website Find all posts by this user Quote this message in a reply
raphael Offline
Member
***

Posts: 474
Joined: Apr 2007
Reputation: 8
Post: #10
RE: Running ISPCP on a low resources system
TAS: Try And See Wink
05-29-2007 08:33 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)