If you want to run ispCP on a low resources system (e.g. a virtual server) try this suggestions.
1. Apache MPM
On most systems Apache consumes most memory. And there are two possibilities to reduce Apache's memory usage. Try which one fits your needs better.
1.1 Configure apache worker MPM
Lower the worker MPM's config values. Modify your apache2.conf accordingly:
# 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>
Another possible change is the default thread stack size (which is 8MB). Some sources tell that 1MB would be enough. But if you don't want to risk to much set it to 4MB. Add this to your apache2.conf:
ThreadStackSize 4000000
Now restart your apache.
1.2 Switch apache to use prefork
Alternatively you can try to use the prefork MPM, which uses less memory, but is also less high-performance.
# aptitude install apache2-mpm-prefork
And modify the config in apache2.conf:
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
StartServers 12
MinSpareServers 12
MaxSpareServers 24
MaxClients 100
MaxRequestsPerChild 0
</IfModule>
Now restart your apache.
2. FastCGI
In /etc/apache2/mods-available/fastcgi_ispcp.conf change this
-idle-timeout 300 # -singleThreshold 100
to this
-idle-timeout 300 \ -singleThreshold 100
Now restart your apache.
This causes that the the last fastcgi-process for a website terminates when it is not used.
3. MySQL
You can lower your MySQL memory usage when you change your my.cnf accordingly:
# # * 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
Another even better possibility is to download and run the "tuning-primer"-script. This script, which was developed by a member of the MySQL staff, suggest you better values for your MYSQL configuration. Some of them also lower memory usage. Remember that your MySQL server should run for at least 2 days before you run this script, otherwise the values won't be correct. You should also repeat the check, when the usage of your database changes very much.
Don't forget to restart MySQL.
4. Unnecessary services
You can also stop unnecessary services to reach your aim.
4.1 Bind
Bind, the DNS service, is mostly never used and consumes about 40MB of memory. Disable it in /etc/ispcp/ispcp.conf:
CMD_NAMED = no
Now you can stop the daemon:
# /etc/init.d/bind9 stop
You should also remove bind from the startup scripts.
4.2 Postgrey
Stop greylisting, which uses about 20MB:
# /etc/init.d/postgrey stop
Now you also have to uncomment it in /etc/postfix/main.cf. Change this line
check_policy_service inet:127.0.0.1:60000,
to this
#check_policy_service inet:127.0.0.1:60000,
You should also remove postgrey from the startup scripts.
5. Further questions / suggestions
If you have questions about this howto or further suggestions, please refer to this forum thread: Running ISPCP on a low resources system
