ispCP - Board - Support
Running ISPCP on a low resources system - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Development Area (/forum-1.html)
+--- Forum: Suggestions (/forum-2.html)
+--- Thread: Running ISPCP on a low resources system (/thread-683.html)

Pages: 1 2 3


Running ISPCP on a low resources system - Daff - 05-27-2007 04:50 AM

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=Low_memory_MySQL_/_Apache_configurations 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/option,com_easyfaq/Itemid,38/task,view/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!


RE: Running ISPCP on a low resources system - BeNe - 05-27-2007 08:08 PM

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=Low_memory_MySQL_/_Apache_configurations 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.


RE: Running ISPCP on a low resources system - Daff - 05-27-2007 09:48 PM

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?


RE: Running ISPCP on a low resources system - BeNe - 05-27-2007 11:33 PM

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 ?


RE: Running ISPCP on a low resources system - Daff - 05-28-2007 12:50 AM

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.


RE: Running ISPCP on a low resources system - raphael - 05-28-2007 08:50 AM

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.


RE: Running ISPCP on a low resources system - Daff - 05-28-2007 09:16 AM

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?


RE: Running ISPCP on a low resources system - raphael - 05-28-2007 10:01 AM

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


RE: Running ISPCP on a low resources system - Daff - 05-28-2007 09:37 PM

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?


RE: Running ISPCP on a low resources system - raphael - 05-29-2007 08:33 AM

TAS: Try And See Wink