
|
View Full Version : How-To: Web Server Optimization Guide
Shaw Networks 11-06-2004, 01:58 AM Hello,
I am sure that all web hosts would like to lower the CPU load of their servers, shorten page load times, and boost overall performance. Whether it be to increase profit margin by packing in more customers or to get a Celeron 1.7Ghz handle a popular forum, we can all benefit from server optimization. Below is a compilation of some methods one may use to optimize a web server to serve web pages faster and lower the overall CPU load on the box. The following are some of the best procedures a web host can do to optimize his or her web server.
1. Basic Config File Editing
Make a backup of your /etc/my.cnf file, and then perform the following via SSH:
pico /etc/my.cnf
Add in the following entries or replace the current existing ones:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-locking
skip-innodb
query_cache_limit=8M
query_cache_size=256M
query_cache_type=1
max_connections=500
max_user_connections=10
interactive_timeout=20
wait_timeout=20
connect_timeout=6
thread_cache_size=128
key_buffer=16M
join_buffer=1M
max_allowed_packet=16M
table_cache=1024
record_buffer=1M
sort_buffer_size=2M
read_buffer_size=2M
max_connect_errors=10
# Try number of CPU's*2 for thread_concurrency
thread_concurrency=4
myisam_sort_buffer_size=64M
#log-bin
server-id=1
[mysql.server]
user=mysql
basedir=/var/lib
[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysql.pid
open_files_limit=8192
[mysqldump]
quick
max_allowed_packet=16M
[mysql]
no-auto-rehash
#safe-updates
[isamchk]
key_buffer=32M
sort_buffer=32M
read_buffer=16M
write_buffer=16M
[myisamchk]
key_buffer=32M
sort_buffer=32M
read_buffer=16M
write_buffer=16M
Hit CTRL + X to exit and save the file
Now to edit the httpd.conf:
pico /usr/local/apache/conf/httpd.conf (or wherever your httpd.conf is located)
Set "Timeout" value to "Timeout 300"
Change "KeepAlive on" to "KeepAlive off"
Set "MinSpareServers" to "MinSpareServers 8"
Set "MaxSpareServers" to "MaxSpareServers 13"
Set "MaxRequestsPerChild" to "MaxRequestsPerChild 50"
Set "HostnameLookups" to "HostnameLookups Off"
CTRL + X to exit and save the file
Restart Apache and MySQL with:
service httpd restart
service mysql restart OR service mysqld restart
Some people may need to restart the services with /etc/rc.d/init.d/httpd restart and /etc/rc.d/init.d/mysql restart
The above changes can be altered and played around with to suit your server's needs (i.e. if your server is fast or not).
2. Installing Mod_Perl
Mod_Perl description: "mod_perl gives you a persistent Perl interpreter embedded in your web server. This lets you avoid the overhead of starting an external interpreter and avoids the penalty of Perl start-up time, giving you super-fast dynamic content. "
Run these commands via SSH:
wget http://perl.apache.org/dist/mod_perl-1.0-current.tar.gz
tar zxvf tar zxvf mod_perl-1.0-current.tar.gz
cd mod_perl-1.29 (or whatever folder is generated)
perl Makefile.PL
If you see any errors about missing dependencies (such as CGI.pm, LWP::UserAgent & HTML::HeadParser required by mod_perl) you may install them with:
perl -MCPAN -e shell
install HTML::HeadParser
If you had to install any dependencies you must re-run "perl Makefile.PL". Back to setting up mod_perl, after perl Makefile.PL run:
make
make install
Congratulations, you've just installed mod_perl. Restart Apache with:
service httpd restart
OR
/etc/rc.d/init.d/httpd restart
3. Install Turck MMCache for PHP
Description: "Turck MMCache is a free open source PHP accelerator, optimizer, encoder and dynamic content cache for PHP. It increases performance of PHP scripts by caching them in compiled state, so that the overhead of compiling is almost completely eliminated. Also it uses some optimizations to speed up execution of PHP scripts. Turck MMCache typically reduces server load and increases the speed of your PHP code by 1-10 times. "
Turck MMCache requires: apache 1.3, mod_php 4.1, autoconf, automake, libtool, m4. You should already have most of these on your server if not use the "apt-get install <dependency here>" command to get them installed. I won't go into detail about this here, you should easily be able to search the net to get them installed.
To install Turck MMCache, perform the following commands via SSH:
wget http://aleron.dl.sourceforge.net/sourceforge/turck-mmcache/turck-mmcache-2.4.6.tar.gz
export PHP_PREFIX="/usr"
$PHP_PREFIX/bin/phpize
./configure --enable-mmcache=shared --with-php-config=$PHP_PREFIX/bin/php-config
(You must specify the real prefix where PHP is installed in the "export" command. It may be "/usr" "/usr/local", or something else.)
make
make install
Turck MMCache can be installed both as Zend or PHP extension, so you need to edit your php.ini file (usually /etc/php.ini).
To install as Zend extension:
zend_extension="/usr/lib/php4/mmcache.so"
mmcache.shm_size="16"
mmcache.cache_dir="/tmp/mmcache"
mmcache.enable="1"
mmcache.optimizer="1"
mmcache.check_mtime="1"
mmcache.debug="0"
mmcache.filter=""
mmcache.shm_max="0"
mmcache.shm_ttl="0"
mmcache.shm_prune_period="0"
mmcache.shm_only="0"
mmcache.compress="1"
To install as PHP extension:
extension="mmcache.so"
mmcache.shm_size="16"
mmcache.cache_dir="/tmp/mmcache"
mmcache.enable="1"
mmcache.optimizer="1"
mmcache.check_mtime="1"
mmcache.debug="0"
mmcache.filter=""
mmcache.shm_max="0"
mmcache.shm_ttl="0"
mmcache.shm_prune_period="0"
mmcache.shm_only="0"
mmcache.compress="1"
You may need to copy the mmcache.so file to the directory specified to the above paths in the configuration entries.
Create the cache directory:
mkdir /tmp/mmcache
chmod 0777 /tmp/mmcache
Restart Apache with:
service httpd restart
OR
/etc/rc.d/init.d/httpd restart
4. Tuning sysctl.conf
The sysctl.conf of a server is something that is seldom optimized for performance. You can get a tremendous boost in throughput by adjusting these settings. This configuration has been written by Steve from Rack911. I have applied this configuration to servers ranging from Celeron 1.7Ghz to Dual Xeon 2.8Ghz servers, and on the whole, the load on each lowered after making the changes.
First make a backup of your old /etc/sysctl.conf file by running the following command, logged in as root:
cp /etc/sysctl.conf /etc/sysctl.conf.bak
Now enter:
pico /etc/sysctl.conf
and replace the contents of the file with the following:
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Disables packet forwarding
net.ipv4.ip_forward=0
# Disables IP source routing
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.lo.accept_source_route = 0
net.ipv4.conf.eth0.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
# Enable IP spoofing protection, turn on source route verification
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.lo.rp_filter = 1
net.ipv4.conf.eth0.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
# Disable ICMP Redirect Acceptance
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.lo.accept_redirects = 0
net.ipv4.conf.eth0.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
# Enable Log Spoofed Packets, Source Routed Packets, Redirect Packets
net.ipv4.conf.all.log_martians = 0
net.ipv4.conf.lo.log_martians = 0
net.ipv4.conf.eth0.log_martians = 0
# Disables IP source routing
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.lo.accept_source_route = 0
net.ipv4.conf.eth0.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
# Enable IP spoofing protection, turn on source route verification
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.lo.rp_filter = 1
net.ipv4.conf.eth0.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
# Disable ICMP Redirect Acceptance
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.lo.accept_redirects = 0
net.ipv4.conf.eth0.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
# Disables the magic-sysrq key
kernel.sysrq = 0
# Decrease the time default value for tcp_fin_timeout connection
net.ipv4.tcp_fin_timeout = 15
# Decrease the time default value for tcp_keepalive_time connection
net.ipv4.tcp_keepalive_time = 1800
# Turn off the tcp_window_scaling
net.ipv4.tcp_window_scaling = 0
# Turn off the tcp_sack
net.ipv4.tcp_sack = 0
# Turn off the tcp_timestamps
net.ipv4.tcp_timestamps = 0
# Enable TCP SYN Cookie Protection
net.ipv4.tcp_syncookies = 1
# Enable ignoring broadcasts request
net.ipv4.icmp_echo_ignore_broadcasts = 1
# Enable bad error message Protection
net.ipv4.icmp_ignore_bogus_error_responses = 1
# Log Spoofed Packets, Source Routed Packets, Redirect Packets
net.ipv4.conf.all.log_martians = 1
# Increases the size of the socket queue (effectively, q0).
net.ipv4.tcp_max_syn_backlog = 1024
# Increase the tcp-time-wait buckets pool size
net.ipv4.tcp_max_tw_buckets = 1440000
# Allowed local port range
net.ipv4.ip_local_port_range = 16384 65536
CTRL + X to exit and save the file
To make your changes take effect immediately, type this command:
/sbin/sysctl -p
You can watch your server load by entering "uptime" command via SSH.
There you have it, a quick few things you can do to your server to boost performance and lower CPU load. Please feel free to post any comments or suggestions.
idontknow 11-06-2004, 09:41 AM Originally posted by IncognitoNet
Change "KeepAlive on" to "KeepAlive off"
Set "MinSpareServers" to "MinSpareServers 8"
Set "MaxSpareServers" to "MaxSpareServers 13"
Set "MaxRequestsPerChild" to "MaxRequestsPerChild 50"
[/B]
This is in prefork.c or worker.c ? How about MaxClients? Ant why MaxRequestsPerChild 50 not 0 ?
Shaw Networks 11-06-2004, 02:42 PM Hello,
Those entries aren't for prefork.c or worker.c I saw your other thread, and I can suggest that you use Apache 1.3.* series rather than the Apache 2.* series. You'll lower CPU usage in that switch alone.
MaxClients you can generally keep to the default; 250 is a good number for most servers, but you may need to adjust depending on your server's hardware specs. I keep MaxRequestsPerChild set to 50 or a little bit higher if your server is faster to keep Apache rotating through child processes and not causing any memory problems that can come from prolonged use of one child process. Overall, it helps out with server load.
idontknow 11-06-2004, 04:35 PM I use Apache 2.x and PLESK. What could you suggest for me?
Shaw Networks 11-06-2004, 04:39 PM I assume that you're using this server for web hosting company; switch over your Apache version from the 2.* series to the 1.3.* series. The 1.3.* series is more stable, secure and process efficient.
idontknow 11-06-2004, 04:46 PM But why PLESK recommend Apache 2.0.x ?
Shaw Networks 11-06-2004, 05:19 PM Perhaps PLESK is reccomending it because Apache 2.0.* offers more features, but our firm does not use PLESK so I cannot comment on exactly why.
idontknow 11-06-2004, 05:35 PM So.. you couldn't suggest me about this? I don't know about this too, and don't know how to optimize
Steven 11-06-2004, 09:10 PM Plesk uses 2.x because it uses the stock rpms from redhat. From reading your posts idontknow, you need to learn more. You have very little systemadmin skills and thats not good....
idontknow 11-07-2004, 03:32 AM There's no to learn from, in plesk forums, WHT, ev1 forums etc. I found nothing about this..
Steven 11-07-2004, 12:07 PM Theres alot to use to learn. The best way to learn is by experiementing.
Shaw Networks 11-07-2004, 11:58 PM Any comments or suggestions for the guide?
rasputinj 11-08-2004, 03:02 AM Originally posted by IncognitoNet
Any comments or suggestions for the guide?
on MMcache, you just need to be careful when you upgrade Apache you will need to comment out mmcache from the php.ini and then you will be able to get Apache to load up again. Then recompile MMcache again.
Please let me know if I am wrong in any of this. I am doing it off of memory from a problem I had a while back.
Steven 11-10-2004, 02:51 PM Thats true rasputiinj
hobbestec 11-10-2004, 03:34 PM Why are you turning KeepAlive off? In Apache's own documentation they say that KeepAlive can help increase the speed up to 50%.
How can you test to see if Turck MMCache for PHP is running on your server?
I know i installed it, but i want to make sure its still functioning like its suppose too.
kenop 11-10-2004, 09:42 PM Great guide... adding this to my new server setup documentation! :thumbsup:
Turboz 11-15-2004, 07:37 AM I like the fact that this handy guide turned up in my search for zend installation, however I notice that this optimization how-to doesn't include installing zend!!!
-Turboz
rasputinj 11-16-2004, 03:34 PM Originally posted by WFWH
How can you test to see if Turck MMCache for PHP is running on your server?
I know i installed it, but i want to make sure its still functioning like its suppose too.
phpinfo
learnerman 11-18-2004, 06:42 AM GREAAAAAAAAAAAT work IncognitoNet
:) thnx alot
Originally posted by rasputinj
phpinfo
It shows nothing about mmcache so I must didn't install it right, did I?
I went through the instruction and it was flawless, no problem at all, and I finally check the php.ini file 5 times, still nothing wrong, so I'm wondering why there is no mmcache info at all using php info, any suggestion?
This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
Originally posted by hobbestec
Why are you turning KeepAlive off? In Apache's own documentation they say that KeepAlive can help increase the speed up to 50%.
KeepAlive OFF to free memory usage but u want to keep it ON and KeepAliveTimeout 5 (a small number anyways)... this way you KeepAlive the conenction until all the images, scripts, css.. whatever are requested ... and free the resource as soon as posible...
stftk 11-26-2004, 09:29 PM In my experience turning KeepAlive off has reduced load and only slightly increases loading time so I would recommend it.
I would also recommend adding this to php.ini:
output_handler = ob_gzhandler
Also, tune the /etc/sysctl.conf, I find this useful: http://forums.ev1servers.net/showthread.php?threadid=48880
Unknown_User 11-28-2004, 04:21 PM Can you explain more about what it is the following does (Each entry)
[mysqld]
skip-locking
max_connections=300
connect_timeout=15
key_buffer=16M
join_buffer=1M
record_buffer=1M
sort_buffer=2M
table_cache=1028
thread_cache_size=286
max_allowed_packet=5M
wait_timeout=15
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
thread_concurrency=2
Thanks ;)
DislexiK
CoishAssociates 12-03-2004, 04:51 PM I get this error...
Please tell me where I can find your apache src
[../apache_x.x/src]
CoishAssociates 12-03-2004, 05:13 PM n/m I figure it out... but now I'm stuck on this....
export PHP_PREFIX="/usr"
$PHP_PREFIX/bin/phpize
./configure --enable-mmcache=shared --with-php-config=$PHP_PREFIX/bin/php-config
(You must specify the real prefix where PHP is installed in the "export" command. It may be "/usr" "/usr/local", or something else.)
Everything I try I get:
-bash: export: `/usr': not a valid identifier
-bash: export: `/usr/local': not a valid identifier
Stupid newb, I know..
ReBoot 12-15-2004, 01:31 AM Originally posted by DislexiK
Can you explain more about what it is the following does (Each entry)
[mysqld]
skip-locking
max_connections=300
connect_timeout=15
key_buffer=16M
join_buffer=1M
record_buffer=1M
sort_buffer=2M
table_cache=1028
thread_cache_size=286
max_allowed_packet=5M
wait_timeout=15
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
thread_concurrency=2
Thanks ;)
DislexiK
mp3sattack 01-14-2005, 11:14 AM is it better to install eaccelerator http://eaccelerator.sourceforge.net/SuccessCasesUk
instead of turck mmcache?
EXOWorks 01-18-2005, 09:03 AM No, turk mmcache is the best choice available according to most of the benchmarks..
If you have websites that needs to serve a lot of images, then you need to set KeepAlive to on and KeepAlivetimeout to a small value like 3 or 5 .. Setting KeepAlive off on servers that serve a lot of images will do more harm than benefit and you'll get a lot of TIME_WAIT's in your netstats increasing the load on server.
As said before, it would be helpful if some of those commands were explained. Any comments on the tutorial from experts are welcome.
hostchamp 02-03-2005, 08:48 AM Can you explain the function/effect of each of the following ;
[mysqld]
skip-locking
max_connections=300
connect_timeout=15
key_buffer=16M
join_buffer=1M
record_buffer=1M
sort_buffer=2M
table_cache=1028
thread_cache_size=286
max_allowed_packet=5M
wait_timeout=15
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
thread_concurrency=2
Thanks
Shaw Networks 03-15-2005, 02:35 AM You'd have better luck heading to MySQL's website and looking up each term in their online reference tool. Value in the my.cnf file is explained pretty well there.
Shaw Networks 03-15-2005, 02:43 AM For people earlier on asking about the KeepAlives, by turning KeepAlives on you'll increase the speed at which Apache loads/serves web pages, but at a decrease in overall performance for other services. Keeping KeepAlives on, can also result in a less stable httpd service, with a server under load. By turning KeepAlives to off, you essentially (short version) slow down the rate at which Apach handles requests, lowering server load, and keeping the httpd service more stable while handling high traffic.
very good.
memory usage and server load is very low.
I only changed the httpd.conf and my.cnf.
Thanks
hostchamp 03-17-2005, 01:47 PM Originally posted by ymfm
very good.
memory usage and server load is very low.
I only changed the httpd.conf and my.cnf.
What changes did you make to httpd.conf and my.cnf ?
Shaw Networks 03-17-2005, 08:36 PM I think he was referring to changes he made to his server, only in the httpd.conf and my.cnf, and noting the positive change.
Some users are receiving the error above while conecting to database.
"Lost connection to mysql server during query"
an user asked me to change this to correct the problem.
Wrom: NQEMSFDULHPQQWOYIY
To: wait_timeout = 28800
WestBend 03-26-2005, 03:10 PM 2 Questions :
How can you see what modules you have installed on Apache 1.3
I read and apparently did not understand mmcache's documentation. Do i need to alter any of the php files to use this or simply install it as you detailed?
Thanks for the tutorial
WestBend 03-26-2005, 05:03 PM Well I followed your instructions. You might want to add that you need to go into the untarred directory before you do your export command. Everything went without a hitch.. restarted apache.. load went up. Pages took longer to load. Once loaded they didnt necessarily bring back graphics or all of the graphics.. do i need to tweak something? Increase shared memory? Anything?
thanks
Shaw Networks 03-26-2005, 09:17 PM ymfm - I'm unsure of what you're asking, are they getting the error after following the tutorial, or on some completely unrelated incident.
WestBend - To see the modules your Apache has compiled in, type in the following command via SSH:
/usr/local/apache/bin/httpd -l
Or wherever your httpd exceutable is located. With Turck MMCache, you won't need to change your PHP pages, Turck MMCache caches them regardless. I'm not sure why your server load actually went up, by turning KeepAlives off, your websites may display slightly slower than with them on, but load drops considerably. There may have been some other factors causing the high load. Did you run the command "uptime" in SSH to watch the load before and after the changes?
WestBend 03-26-2005, 09:26 PM I had top running and was watching the load that way.
I do have KeepAlives On.
I installed everything and load was around .6. I restarted httpd and gave it a few seconds and then went to one of the busier sites i run and the first time i visited the site it gave me page not found. then i refreshed and it came back fine. I went to another site and it came back without their logo graphic. Refreshed same.. refreshed.. got a page with no graphics all text and no css layout.. refreshed.. got logo.. refreshed.. got page formatted correctly but no logo again.
I primarily run Blog hosting servers so caching php would be great lol.
I will wait till later tonight and alter keep alives and try it again using uptime.
thanks
Shaw Networks 03-27-2005, 05:38 AM Turning keepalives off will definitely lower the overall load of your server, try it on and off, you'll see the difference. Feel free to post the URL of the problematic website, the problem you're having is quite a strange one.
Website Rob 03-27-2005, 07:45 AM It used to be that WHM & mod_perl did not work well together. I tried and so did the DC tech with no luck, and we tried both: DSO and as a module. It was over a year ago, though, and things may have changed. Hopefully they have because I would love to be able to use mod_perl but will not spend the hour or two necessary to experiment nor put up with Apache problems for Clients.
As to the Turk mmCache problems, it has nothing to do with Apache, really, and everything to do with the install itself and PHP settings. You need to edit your 'php.ini' to include it along with certain settings. This is a good install Tutorial: http://www.webhostgear.com/130.html
Settings for Apache can be quite controversial and for varied reasons. One should start with a basic settings and go from there, to see what works best with their Server.
Here is what I would recommend to start:
Timeout 30
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 30
MinSpareServers 5
MaxSpareServers 10
StartServers 5
MaxClients 180
MaxRequestsPerChild 1000
I have seen people post where they change Min/Max SpareServers to unGodly numbers, when it is the StartServers settings one should be changing. And even then, only in increments of an extra 3 - 5 at a time.
As already mentioned, experience is your best Teacher and it's not uncommon to have custom settings for each Server. Just like the often asked question; "How many accounts can a Server handle?" the answer to that and what Server settings to use is; "It all depends on the type of sites being Hosted." :)
SBS Marketing 03-27-2005, 09:42 PM Originally posted by Cameronjc
I get this error...
Please tell me where I can find your apache src
[../apache_x.x/src]
Where do I tell it to find it? I feel like a fool!
Thanks!
Shaw Networks 03-29-2005, 10:50 PM I'm not quite understanding what problem you're having. If you're having problems finding your Apache installation, then you probably should get a server admin to do this tutorial for you.
SBS Marketing 03-29-2005, 11:13 PM Wow - ask a simple question -
Website Rob 03-30-2005, 01:42 AM IncognitoNetworks, how bout a reply to my question?
Have you been successful in getting mod_perl to operate properly with a Server using WHM/Cpanel? And if so, as a module or DSO?
As you had originally mentioned about posting any comments or suggestions, I would really like to know if someone has been successful
Shaw Networks 03-30-2005, 02:05 PM Website Rob - Yes, and if you have cPanel you can setup your Apache version with mod_perl directly from WHM. "Update Apache" link -> check the "Perl Module" box -> set any other options -> click build
Website Rob 03-30-2005, 05:29 PM Ok, thanks for the clarification. Shall have to give it a go and see how it works out.
As mod_perl can greatly reduce CPU overhead on any Server, regardless of what Control Panel is used, it is a module definitely worth installing.
Shaw Networks 04-03-2005, 04:51 PM I've added a section to the original post on sysctl.conf tuning, enjoy :)
SBS Marketing 04-08-2005, 12:54 AM Originally posted by IncognitoNetworks
Website Rob - Yes, and if you have cPanel you can setup your Apache version with mod_perl directly from WHM. "Update Apache" link -> check the "Perl Module" box -> set any other options -> click build
I really like the Perl Module - however according to Cpanel:
Perl Module (not required to run .cgi scripts/not compatible with php) (Version 1.29)
Does this mean that there are issues with php & Mod_perl?
whoim 04-08-2005, 03:49 AM Is there any variable in my.cnf which can limit connections per user per hour?
Shaw Networks 04-09-2005, 02:01 AM Originally posted by SBS Marketing
I really like the Perl Module - however according to Cpanel:
Perl Module (not required to run .cgi scripts/not compatible with php) (Version 1.29)
Does this mean that there are issues with php & Mod_perl?
That just means that you'll still be able to run cgi/perl scripts without mod_perl, but it would still be advantageous to compile it in with Apache (much faster CGI script speeds). There aren't any compatibility issues with mod_perl and PHP.
Shaw Networks 04-09-2005, 02:02 AM Originally posted by whoim
Is there any variable in my.cnf which can limit connections per user per hour?
I haven't heard of such an option before. It may exist, but it would be a surprise to me.
whoim 04-09-2005, 02:06 AM IncognitoNetworks, I know few sites which limit mySQL connections per user per hour, but I don't know how.
Shaw Networks 04-09-2005, 03:07 PM This may put you in the right direction: http://mysqld.active-venture.com/User_resources.html
whoim 04-10-2005, 04:49 AM GRANT USAGE ON *.* TO '%'@'localhost' WITH MAX_QUERIES_PER_HOUR 100;
This should work? I want to do this for ALL users. Thanks in advance.
one1coolone1 04-20-2005, 11:07 PM This post has been very helpfull for a new Linux fan like me :)
Thank you all for helping out :)
tubcan 04-27-2005, 08:11 AM Originally posted by IncognitoNetworks
Website Rob - Yes, and if you have cPanel you can setup your Apache version with mod_perl directly from WHM. "Update Apache" link -> check the "Perl Module" box -> set any other options -> click build
a small newbie question
after doing that step, should I add/edit any other config ?
NicAddress 04-29-2005, 10:37 AM Anyone?
error: permission denied on key 'net.ipv4.tcp_fin_timeout'
error: permission denied on key 'net.ipv4.tcp_keepalive_time'
error: permission denied on key 'net.ipv4.tcp_window_scaling'
error: permission denied on key 'net.ipv4.tcp_sack'
error: permission denied on key 'net.ipv4.tcp_fack'
error: permission denied on key 'net.ipv4.tcp_timestamps'
error: permission denied on key 'net.ipv4.tcp_syncookies'
error: permission denied on key 'net.ipv4.icmp_echo_ignore_broadcasts'
error: permission denied on key 'net.ipv4.icmp_ignore_bogus_error_responses'
error: permission denied on key 'net.ipv4.tcp_reordering'
error: permission denied on key 'net.ipv4.tcp_synack_retries'
error: permission denied on key 'net.ipv4.tcp_syn_retries'
error: permission denied on key 'net.ipv4.tcp_max_syn_backlog'
error: permission denied on key 'net.core.netdev_max_backlog'
error: permission denied on key 'net.core.hot_list_length'
error: permission denied on key 'net.ipv4.tcp_max_tw_buckets'
ben_leow 05-12-2005, 08:14 AM I have followed the installation method for mod_perl and completed it. But when I checked my httpd.conf file, there is no mod_perl in LoadModule. Is it normal? Also, when I run /usr/local/apache/bin/httpd -l, there is nothing that says mod_perl. Again, is it normal? My server is on whm. I would have installed it in WHM as described by
IncognitoNetworks if I read his post before I installed it. Now will there be any problem? Do I need to uninstall/remove mod_perl?
myusername 06-30-2005, 06:51 PM Originally posted by SBS Marketing
I really like the Perl Module - however according to Cpanel:
Perl Module (not required to run .cgi scripts/not compatible with php) (Version 1.29)
Does this mean that there are issues with php & Mod_perl?
Then
Originally posted by IncognitoNetworks
That just means that you'll still be able to run cgi/perl scripts without mod_perl, but it would still be advantageous to compile it in with Apache (much faster CGI script speeds). There aren't any compatibility issues with mod_perl and PHP.
Can anyone confirm that checking both boxes in WHM, one for mod_perl and the other for PHP will not break PHP installations?
I guess I have a different thought process when I read:
not compatible with php
Wow, really nice howto. I found this board just today, but I already love it ;)
Website Rob 07-04-2005, 11:50 AM I've still had no luck installing mod_perl although, fast_cgi can be installed manually without any problems.
Guess I'll leave this mod alone as previous attempts to install it through EasyApache (just doesn't work) and by manual install (locks up the Server) shows that it just doesn't work yet, with WHM/Cpanel.
BaselineAce 07-23-2005, 09:29 AM It has helped us, thanks.
alexis 09-25-2005, 11:20 PM From the original post:
[mysqld]
skip-locking
max_connections=300
connect_timeout=15
key_buffer=16M
join_buffer=1M
record_buffer=1M
sort_buffer=2M
table_cache=1028
thread_cache_size=286
max_allowed_packet=5M
wait_timeout=15
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
thread_concurrency=2
I think you meant:
table_cache=128
I just crashed one server :)
Regards!
Shaw Networks 10-16-2005, 03:57 PM Originally posted by alexis
From the original post:
I think you meant:
table_cache=128
I just crashed one server :)
Regards!
Actually I use 1028 on all of my servers, no problem at all with that setting. I have a further optimized my.cnf file that I'll be posting shortly and update my original post with.
Shaw Networks 10-16-2005, 03:59 PM Here's the latest /etc/my.cnf that we use on our servers.
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-locking
skip-innodb
query_cache_limit=8M
query_cache_size=256M
query_cache_type=1
max_connections=500
max_user_connections=10
interactive_timeout=20
wait_timeout=20
connect_timeout=6
thread_cache_size=128
key_buffer=16M
join_buffer=1M
max_allowed_packet=16M
table_cache=1024
record_buffer=1M
sort_buffer_size=2M
read_buffer_size=2M
max_connect_errors=10
# Try number of CPU's*2 for thread_concurrency
thread_concurrency=4
myisam_sort_buffer_size=64M
#log-bin
server-id=1
[mysql.server]
user=mysql
basedir=/var/lib
[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysql.pid
open_files_limit=8192
[mysqldump]
quick
max_allowed_packet=16M
[mysql]
no-auto-rehash
#safe-updates
[isamchk]
key_buffer=32M
sort_buffer=32M
read_buffer=16M
write_buffer=16M
[myisamchk]
key_buffer=32M
sort_buffer=32M
read_buffer=16M
write_buffer=16M
alexis 10-16-2005, 06:17 PM My mistake, I had the extra good luck of having a client with a bad PHP script crashing MySQL at the same time I was tuning the server :)
Shaw Networks 10-18-2005, 04:28 PM Originally posted by alexis
My mistake, I had the extra good luck of having a client with a bad PHP script crashing MySQL at the same time I was tuning the server :)
Yep, that'll do it :)
Shaw Networks 10-20-2005, 07:36 PM Originally posted by IncognitoNetworks
Actually I use 1028 on all of my servers, no problem at all with that setting. I have a further optimized my.cnf file that I'll be posting shortly and update my original post with.
My original post has now been edited.
Shaw Networks 10-26-2005, 06:40 PM Originally posted by Gump
Then
Can anyone confirm that checking both boxes in WHM, one for mod_perl and the other for PHP will not break PHP installations?
I guess I have a different thought process when I read:
not compatible with php
No, mod_perl works fine with PHP, we've installed it many times on our servers with and without WHM. Since virtually all web servers run PHP, if there was an issue with PHP and mod_perl, mod_perl would be useless.
PTNHosting 11-06-2005, 03:19 PM I just whant to congratulate IncognitoNetworks for this Guide.
Today i hade a forum hosted on one of ower servers that received over 110000 connections and over 500 Simultaneos users on it, server load was at 20 but the server was performing like a chame :)
Thank you very much.
Regards,
Ruben
renegadeavenger 11-08-2005, 10:31 PM i just wanted to ask.. comparing maxchildperrequest 30 with 50, what is the main differences?
phantomk 11-09-2005, 10:36 AM I am currently running a Dedicated server with a 2.4 Celeron Processor w/ 512 MB DDR and running Debian Sarge. I am running apache2, php 4.4, mysql 4, postfix and courier e-mail services. I am hosting just one website, which runs a heavily modified phpBB, and I am getting average Page Gen times of 0.0414 to 0.1472 with roughly 9 to 12 Queries, access time usually around this value 0.0039.
The following is a copy of my apache2.conf, which has been heavily modified
ServerRoot "/etc/apache2"
LockFile /var/lock/apache2/accept.lock
PidFile /var/run/apache2.pid
Timeout 60
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
UseCanonicalName Off
HostnameLookups Off
EnableSendfile On
ServerTokens Prod
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 20
MaxRequestsPerChild 0
User www-data
Group www-data
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
ErrorLog /var/log/apache2/error.log
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf
Include /etc/apache2/httpd.conf
Include /etc/apache2/ports.conf
Include /etc/apache2/conf.d/[^.#]*
DirectoryIndex index.php /error.php?mode=403
AccessFileName .htaccess
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>
TypesConfig /etc/mime.types
DefaultType text/plain
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^gnome-vfs" redirect-carefully
BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
Include /etc/apache2/sites-enabled/[^.#]*
The apache2 modules activated are:
include
mod-security
perl
php4
rewrite
userdir
I have eaccelerator installed, I prefer it over MMCache because it is kept up-to-date and is still in development.
Here is a copy of my my.cnf, which has been barely modified
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking
bind-address = 127.0.0.1
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 128K
query_cache_limit = 1048576
query_cache_size = 16777216
query_cache_type = 1
log-bin = /var/log/mysql/mysql-bin.log
max_binlog_size = 104857600
skip-bdb
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
[isamchk]
key_buffer = 16M
I am getting a decent server load I believe for the server right now, since thier are very few ppl on the site at any given time.
I was wondering if anyone is able to suggest any changes, especially to my.cnf, to help boost the performance.
albano 11-18-2005, 02:05 AM max_user_connections=10
Does that mean only 10 concurrent users on forum/gallery?!?
Shock Hosts 11-20-2005, 01:43 AM tar zxvf tar zxvf mod_perl-1.0-current.tar.gz
Shouldn't it be:
tar zxvf mod_perl-1.0-current.tar.gz
Is it just a typo?
Shaw Networks 11-26-2005, 02:14 AM Does that mean only 10 concurrent users on forum/gallery?!?
Nope, that just means only 10 concurrent MySQL queries per user could be run at once. This would not mean a user limit, a forum would still be able to run with hundreds of visitors at once.
kafloofen 11-27-2005, 07:21 PM Anyone?
error: permission denied on key 'net.ipv4.tcp_fin_timeout'
error: permission denied on key 'net.ipv4.tcp_keepalive_time'
error: permission denied on key 'net.ipv4.tcp_window_scaling'
error: permission denied on key 'net.ipv4.tcp_sack'
error: permission denied on key 'net.ipv4.tcp_fack'
error: permission denied on key 'net.ipv4.tcp_timestamps'
error: permission denied on key 'net.ipv4.tcp_syncookies'
error: permission denied on key 'net.ipv4.icmp_echo_ignore_broadcasts'
error: permission denied on key 'net.ipv4.icmp_ignore_bogus_error_responses'
error: permission denied on key 'net.ipv4.tcp_reordering'
error: permission denied on key 'net.ipv4.tcp_synack_retries'
error: permission denied on key 'net.ipv4.tcp_syn_retries'
error: permission denied on key 'net.ipv4.tcp_max_syn_backlog'
error: permission denied on key 'net.core.netdev_max_backlog'
error: permission denied on key 'net.core.hot_list_length'
error: permission denied on key 'net.ipv4.tcp_max_tw_buckets'
I'm getting these errors too when trying the /ect/sysctl.conf edit. I'm on VPS.
:S
any suggestions? Thanks in advance.
jalapeno55 12-10-2005, 03:04 AM Isn't this a lot?
MinSpareServers 5
MaxSpareServers 10
StartServers 5
What happens if I change this to:
MinSpareServers 2
MaxSpareServers 5
StartServers 2
How will my server perform? What exactly do the spare servers do?
Shaw Networks 12-12-2005, 02:22 AM Isn't this a lot?
MinSpareServers 5
MaxSpareServers 10
StartServers 5
What happens if I change this to:
MinSpareServers 2
MaxSpareServers 5
StartServers 2
How will my server perform? What exactly do the spare servers do?
This page should explain everything:
http://httpd.apache.org/docs/2.0/mod/prefork.html#minspareservers
In most cases the MinSpareServers don't need to be tweaked that much.
Shaw Networks 12-27-2005, 08:04 PM Update: New optimization techniques dealing with per-site resource hogs will be updated into the main post shortly. The techniques should be particularly helpful for web hosts dealing with clients running poorly coded applications, or websites that receive mad rushes of download traffic. Check back soon!
Website Rob - Yes, and if you have cPanel you can setup your Apache version with mod_perl directly from WHM. "Update Apache" link -> check the "Perl Module" box -> set any other options -> click build
My httpd fail after i done that...since yesterday
HD Fanatic 12-28-2005, 05:09 AM Update: New optimization techniques dealing with per-site resource hogs will be updated into the main post shortly. The techniques should be particularly helpful for web hosts dealing with clients running poorly coded applications, or websites that receive mad rushes of download traffic. Check back soon!
Great, I have been getting hammered with many downloads, 100+ apache connections getting big media files. Thanks for everything! :lovewht:
HD Fanatic 12-28-2005, 05:11 AM Here's the latest /etc/my.cnf that we use on our servers.
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-locking
skip-innodb
query_cache_limit=8M
query_cache_size=256M
query_cache_type=1
max_connections=500
max_user_connections=10
interactive_timeout=20
wait_timeout=20
connect_timeout=6
thread_cache_size=128
key_buffer=16M
join_buffer=1M
max_allowed_packet=16M
table_cache=1024
record_buffer=1M
sort_buffer_size=2M
read_buffer_size=2M
max_connect_errors=10
# Try number of CPU's*2 for thread_concurrency
thread_concurrency=4
myisam_sort_buffer_size=64M
#log-bin
server-id=1
[mysql.server]
user=mysql
basedir=/var/lib
[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysql.pid
open_files_limit=8192
[mysqldump]
quick
max_allowed_packet=16M
[mysql]
no-auto-rehash
#safe-updates
[isamchk]
key_buffer=32M
sort_buffer=32M
read_buffer=16M
write_buffer=16M
[myisamchk]
key_buffer=32M
sort_buffer=32M
read_buffer=16M
write_buffer=16M
What server specs, mysql, php versions, and what kind of site is it tailored for?
Shaw Networks 12-28-2005, 05:20 AM What server specs, mysql, php versions, and what kind of site is it tailored for?
Those settings have been customized for a dual xeon machine handling a general high MySQL load. For single processor machines you'll want to set the thread_concurrency to 2 instead of 4.
Shaw Networks 12-28-2005, 05:21 AM My httpd fail after i done that...since yesterday
I'm certain that wouldn't have been caused by adding in mod_perl to your Apache installation. If it continues to happen, then you can just as easily install mod_perl manually.
indy500 12-28-2005, 06:57 AM sweetness of a forum & helpful people like this. stick this please. :) my bookmark maybe lost when i need this again.
FestiveHosting 12-28-2005, 07:17 AM My httpd fail after i done that...since yesterday
I had the exact same problem and had to restore from a backup.
DigitalN 12-28-2005, 07:19 AM "mod_perl scripts always run under the user and group IDs of the httpd process. You can’t execute them with the privileges of another user or group using the suEXEC mechanism the way you can with standalone scripts."
Are you configuring apache to run all cgi scripts under mod_perl or using a different script alias? Having suexec working for scripts is a security setting that I wouldn't want to sacrifice, as php is the main language these days on web servers, is mod_perl really worth it for relaxed security?
Shaw Networks 12-28-2005, 09:54 PM Having suexec working for scripts is a security setting that I wouldn't want to sacrifice, as php is the main language these days on web servers, is mod_perl really worth it for relaxed security?
I do not consider myself a security expert by any means, however, any possible security issues posed by installing mod_perl with Apache and thus disabling suEXEC functionality would be minor. The article you referenced discussing the advantages and disadvantages of mod_perl does not directly concern itself with potential security issues. Since the objective of the guide is to reduce server load, I believe that it is a good choice to enable mod_perl.
On a sidenote the referenced article can be found at:
http://www.samspublishing.com/articles/article.asp?p=23010&rl=1
DigitalN 12-28-2005, 11:48 PM I do not consider myself a security expert by any means, however, any possible security issues posed by installing mod_perl with Apache and thus disabling suEXEC functionality would be minor. The article you referenced discussing the advantages and disadvantages of mod_perl does not directly concern itself with potential security issues. Since the objective of the guide is to reduce server load, I believe that it is a good choice to enable mod_perl.
On a sidenote the referenced article can be found at:
http://www.samspublishing.com/articles/article.asp?p=23010&rl=1
Indeed, however I did feel it worth mentioning, since most people within this thread, have no idea why they are changing settings and installing what they are installing. Performance tweaks, ok, but changing the operation of how apache is working with scripts, is something that folks need to be aware of.
Nice post and nicely put together, just short of a few 'why' and 'how's' imho.
Shaw Networks 12-29-2005, 04:29 AM Indeed, however I did feel it worth mentioning, since most people within this thread, have no idea why they are changing settings and installing what they are installing. Performance tweaks, ok, but changing the operation of how apache is working with scripts, is something that folks need to be aware of.
Nice post and nicely put together, just short of a few 'why' and 'how's' imho.
That's true, thanks for the contribution :) I think I'll write in some more explanations with the next revision.
does anyone knows anything like this post for FreeBSD servers?
Shaw Networks 01-06-2006, 03:26 AM does anyone knows anything like this post for FreeBSD servers?
I haven't seen a FreeBSD specific server optimization guide before. Though, some of the stuff in this guide will work for FreeBSD servers too.
I haven't seen a FreeBSD specific server optimization guide before. Though, some of the stuff in this guide will work for FreeBSD servers too.
which parts if you care to highlight please?
thanks
Shaw Networks 01-11-2006, 10:44 PM which parts if you care to highlight please?
thanks
I believe that everything except for the sysctl.conf tuning would be possible. I have virtually no experience in administrating FreeBSD servers though, so someone with the proper experience please correct me if I'm mistaken.
Shaw Networks 01-20-2006, 03:22 AM I believe that everything except for the sysctl.conf tuning would be possible. I have virtually no experience in administrating FreeBSD servers though, so someone with the proper experience please correct me if I'm mistaken.
D4C -
I just had this verified by a FreeBSD server admin, you should be able to use the tutorial just fine.
RAH104 01-31-2006, 10:30 AM Another great tuturial! Thanks! :lovewht:
CRUEL 02-01-2006, 01:29 PM keepalive off
Is there the damage ?
Shaw Networks 02-04-2006, 05:01 AM Is there the damage ?
Nope, no damage to your server will be incurred by making that setting.
ProHS 03-18-2006, 02:57 AM If i decided to install Turck MMCache for PHP would it replace Zend or work along with it or will zend script work using Turck MMCache for PHP? The reason i am asking is because i use ModernBill and Zend it a must have, btw everything else i have done in your how-to has free up over 200 MB of memory, thank you.
Shaw Networks 03-18-2006, 02:44 PM If i decided to install Turck MMCache for PHP would it replace Zend or work along with it or will zend script work using Turck MMCache for PHP? The reason i am asking is because i use ModernBill and Zend it a must have, btw everything else i have done in your how-to has free up over 200 MB of memory, thank you.
It's been a little while since I've used Turck MMCache, however Zend Optimizer should work with Turck MMCache as long as you re-compile after Turck MMCache has been installed.
Glad to hear that this tutorial has helped your system, Turck MMCache should improve performance greatly as well.
layer0 03-18-2006, 09:09 PM Why not use eAccelerator instead of Turck?
chillax 04-11-2006, 03:14 PM thx a lot incognitonetworks for this guide :)
free ram went up to 1163 MB from a paltry 200 MB :D
thx a lot!
for others reading my post, i edited my.cnf, httpd.conf, sysctl.conf according to the first post
Sillysoft 04-24-2006, 01:44 PM So do you still recommend Apache 1.x over Apache 2.x? I have a virtual host setup with many hosts, its a mix of static and dynamic sites. I see they released Apache 2.2. Im currently running Apache 2.x via RPM, but planning to redo the whole server so dont mind installing from source.
Thanks
Silly
^LinuX^ServeR^ 04-30-2006, 01:42 PM UP UP :lovewht:
^LinuX^ServeR^ 04-30-2006, 01:47 PM Hello ,
Please Help Me in optimzing my server :( .
http://www.webhostingtalk.com/showthread.php?t=506616
Best Regards"
.com.net.org 05-04-2006, 05:13 PM Just discovered this. Nice one.
Nimrud 05-09-2006, 11:22 AM Dear IncognitoNetworks and Friends,
Could you please help me with your experience by ckecking and recommending
the load and RAM values for our 64 bite shared memory dual Itanium2 server?
OS: SLES 9
Apache: 2.2
PHP: 5.1.2
MySQL: MySQL 5.0.20a-standard
At the moment we serve 650 domains, and the total number of databases is 449.
Settings, server-statistics:
##########################
Apache server-status:
Current Time: Tuesday, 09-May-2006 15:48:19 CEST
Restart Time: Monday, 08-May-2006 18:54:11 CEST
Parent Server Generation: 0
Server uptime: 20 hours 54 minutes 7 seconds
Total accesses: 1820107 - Total Traffic: 26.0 GB
CPU Usage: u203.728 s14.1572 cu3.71875 cs0 - .295% CPU load
24.2 requests/sec - 362.8 kB/second - 15.0 kB/request
65 requests currently being processed, 13 idle workers
KW_.WWCCKWKW.KK.KCKKKK_WC_KCKW..KKKW_KW.KCKK_KK__CKK_KCCK..KWKKK
K_WKK_K.K_.CK.K.WK.C_.K.........K.C.......W._K..................
................................................................
................................................................
##########################
our top-values are the following:
top - 16:07:26 up 17 days, 2:39, 1 user, load average: 7.70, 6.43, 5.67
Tasks: 184 total, 5 running, 178 sleeping, 0 stopped, 1 zombie
Cpu(s): 96.4% us, 3.0% sy, 0.0% ni, 0.0% id, 0.0% wa, 0.3% hi, 0.3% si
Mem: 3956864k total, 3871312k used, 85552k free, 64k buffers
Swap: 2104352k total, 7792k used, 2096560k free, 1938768k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
20217 www 25 0 54480 37m 11m R 43.1 1.0 0:10.52 httpd
14549 www 25 0 55936 38m 11m R 36.5 1.0 19:07.41 httpd
19937 www 25 0 58880 42m 11m R 36.2 1.1 0:35.68 httpd
19456 www 25 0 56384 39m 11m R 33.2 1.0 0:16.35 httpd
5524 mysql 15 0 425m 145m 11m S 13.3 3.8 412:06.90 mysqld
19849 www 17 0 62112 45m 11m S 5.0 1.2 0:01.93 httpd
20163 www 15 0 57360 41m 11m S 4.9 1.1 0:00.63 httpd
20345 www 15 0 56336 39m 11m S 2.6 1.0 0:00.34 httpd
20434 www 15 0 52816 35m 11m S 2.3 0.9 0:00.12 httpd
20409 www 17 0 53168 36m 11m S 2.1 0.9 0:00.11 httpd
20351 www 17 0 53168 36m 11m S 2.0 0.9 0:00.19 httpd
20321 www 16 0 62816 46m 11m S 1.2 1.2 0:01.35 httpd
20437 www 17 0 52128 34m 10m S 1.0 0.9 0:00.10 httpd
19941 www 16 0 58960 42m 11m S 0.6 1.1 0:01.60 httpd
20042 www 16 0 55872 39m 11m S 0.6 1.0 0:00.83 httpd
20477 root 16 0 4496 2640 1952 R 0.6 0.1 0:00.09 top
19851 www 17 0 69712 53m 11m S 0.4 1.4 0:01.89 httpd
##########################
httpd.conf
Listen 80
MaxKeepAliveRequests 100
KeepAliveTimeout 2
Timeout 60
HostNameLookups Off
LoadModule php5_module modules/libphp5.so
<IfModule !mpm_winnt_module>
<IfModule !mpm_netware_module>
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
AllowOverride All
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>
##########################
httpd-mpm.conf
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_worker_module>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
##########################
mysql conf
#password = your_password
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
socket = /tmp/mysql.sock
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 128K
table_cache = 1024
sort_buffer_size = 4M
record_buffer=1M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
join_buffer_size = 2M
read_buffer_size = 1M
sort_buffer_size = 2M
tmp_table_size = 128M
read_rnd_buffer_size = 524288
bulk_insert_buffer_size = 8M
max_allowed_packet = 16M
query_cache_limit = 8M
query_cache_size = 256M
query_cache_type = 1
thread_cache = 8
thread_cache_size = 128
query_cache_size = 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 4
max_connections=63536
interactive_timeout=20
wait_timeout=20
connect_timeout=6
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[isamchk]
key_buffer = 16M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit = 63536
##########################
eaccelerator Release-0.9.5-beta1 conf
extension="eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/data/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
##########################
Many thanks,
Nim
mp459 05-17-2006, 06:08 PM maybe I missed this, but how about adding
net.ipv4.tcp_synack_retries = 3
to sysctl.conf ?
Y
Shaw Networks 06-11-2006, 03:52 PM Dear IncognitoNetworks and Friends,
Could you please help me with your experience by ckecking and recommending
the load and RAM values for our 64 bite shared memory dual Itanium2 server?
OS: SLES 9
Apache: 2.2
PHP: 5.1.2
MySQL: MySQL 5.0.20a-standard
At the moment we serve 650 domains, and the total number of databases is 449.
Settings, server-statistics:
##########################
Apache server-status:
Current Time: Tuesday, 09-May-2006 15:48:19 CEST
Restart Time: Monday, 08-May-2006 18:54:11 CEST
Parent Server Generation: 0
Server uptime: 20 hours 54 minutes 7 seconds
Total accesses: 1820107 - Total Traffic: 26.0 GB
CPU Usage: u203.728 s14.1572 cu3.71875 cs0 - .295% CPU load
24.2 requests/sec - 362.8 kB/second - 15.0 kB/request
65 requests currently being processed, 13 idle workers
KW_.WWCCKWKW.KK.KCKKKK_WC_KCKW..KKKW_KW.KCKK_KK__CKK_KCCK..KWKKK
K_WKK_K.K_.CK.K.WK.C_.K.........K.C.......W._K..................
................................................................
................................................................
##########################
our top-values are the following:
top - 16:07:26 up 17 days, 2:39, 1 user, load average: 7.70, 6.43, 5.67
Tasks: 184 total, 5 running, 178 sleeping, 0 stopped, 1 zombie
Cpu(s): 96.4% us, 3.0% sy, 0.0% ni, 0.0% id, 0.0% wa, 0.3% hi, 0.3% si
Mem: 3956864k total, 3871312k used, 85552k free, 64k buffers
Swap: 2104352k total, 7792k used, 2096560k free, 1938768k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
20217 www 25 0 54480 37m 11m R 43.1 1.0 0:10.52 httpd
14549 www 25 0 55936 38m 11m R 36.5 1.0 19:07.41 httpd
19937 www 25 0 58880 42m 11m R 36.2 1.1 0:35.68 httpd
19456 www 25 0 56384 39m 11m R 33.2 1.0 0:16.35 httpd
5524 mysql 15 0 425m 145m 11m S 13.3 3.8 412:06.90 mysqld
19849 www 17 0 62112 45m 11m S 5.0 1.2 0:01.93 httpd
20163 www 15 0 57360 41m 11m S 4.9 1.1 0:00.63 httpd
20345 www 15 0 56336 39m 11m S 2.6 1.0 0:00.34 httpd
20434 www 15 0 52816 35m 11m S 2.3 0.9 0:00.12 httpd
20409 www 17 0 53168 36m 11m S 2.1 0.9 0:00.11 httpd
20351 www 17 0 53168 36m 11m S 2.0 0.9 0:00.19 httpd
20321 www 16 0 62816 46m 11m S 1.2 1.2 0:01.35 httpd
20437 www 17 0 52128 34m 10m S 1.0 0.9 0:00.10 httpd
19941 www 16 0 58960 42m 11m S 0.6 1.1 0:01.60 httpd
20042 www 16 0 55872 39m 11m S 0.6 1.0 0:00.83 httpd
20477 root 16 0 4496 2640 1952 R 0.6 0.1 0:00.09 top
19851 www 17 0 69712 53m 11m S 0.4 1.4 0:01.89 httpd
##########################
httpd.conf
Listen 80
MaxKeepAliveRequests 100
KeepAliveTimeout 2
Timeout 60
HostNameLookups Off
LoadModule php5_module modules/libphp5.so
<IfModule !mpm_winnt_module>
<IfModule !mpm_netware_module>
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
AllowOverride All
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>
##########################
httpd-mpm.conf
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_worker_module>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
##########################
mysql conf
#password = your_password
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
socket = /tmp/mysql.sock
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 128K
table_cache = 1024
sort_buffer_size = 4M
record_buffer=1M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
join_buffer_size = 2M
read_buffer_size = 1M
sort_buffer_size = 2M
tmp_table_size = 128M
read_rnd_buffer_size = 524288
bulk_insert_buffer_size = 8M
max_allowed_packet = 16M
query_cache_limit = 8M
query_cache_size = 256M
query_cache_type = 1
thread_cache = 8
thread_cache_size = 128
query_cache_size = 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 4
max_connections=63536
interactive_timeout=20
wait_timeout=20
connect_timeout=6
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[isamchk]
key_buffer = 16M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit = 63536
##########################
eaccelerator Release-0.9.5-beta1 conf
extension="eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/data/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
##########################
Many thanks,
Nim
With a server like that you'll have better results by kicking up your Min and Max Spare servers with Apache and increasing the MySQL buffer sizes a bit. Try out several different configurations and see how they run.
jagsinc 07-08-2006, 09:25 AM thx a lot incognitonetworks for this guide :)
free ram went up to 1163 MB from a paltry 200 MB :D
thx a lot!
for others reading my post, i edited my.cnf, httpd.conf, sysctl.conf according to the first post
Hello IncognitoNetworks.
Nice to see an experinced admin helping us newbies :)
Would you mind posting you latest optimized config?
Thanks
Jags
Shaw Networks 07-14-2006, 02:46 PM Hello IncognitoNetworks.
Nice to see an experinced admin helping us newbies :)
Would you mind posting you latest optimized config?
Thanks
Jags
Sure, check back soon for an updated version of what we have running on most of our servers.
nomore 07-15-2006, 01:18 PM Hi
this link is broken, pls fix it
=====
http://aleron.dl.sourceforge.net/sourceforge/turck-mmcache/turck-mmcache-2.4.6.tar.gz
=====
Tnx
Shaw Networks 07-24-2006, 10:30 PM Hi
this link is broken, pls fix it
=====
http://aleron.dl.sourceforge.net/sourceforge/turck-mmcache/turck-mmcache-2.4.6.tar.gz
=====
Tnx
Thanks for the notice, could a mod update that link with:
http://superb-east.dl.sourceforge.net/sourceforge/turck-mmcache/turck-mmcache-2.4.6.tar.gz
Velvet Elvis 07-25-2006, 05:49 PM At some point this thread is going to need to be unstickied as the mysql4 and apache1 specific stuff is going to confuse a lot of people. Haven't most distros retired apache 1.x by now? I know it's not in the current testing version of debian they are hardly known for being cutting edge.
Turck hasn't been maintained for years so there is no gaurentee that it will work will current php4, let alone php5.
I've been using the alternative php cache package for a while now with good results. I've listed the url below but I strongly recomend finding a package for your distrobution.
http://pecl.php.net/package/APC
Anyone who builds a new server now with old apache is going to be limiting their upgrade path. You don't know that you'll be able to run php6 or the next ruby or phyton on 1x a couple years from now and migrating an operational server is a bitch and half. Right now I'm setting stuff up with mysql5, php5, and apache2 so hopefully I won't have to do any major upgrades for a long time once everything is up and running.
NTHosts 07-27-2006, 06:44 AM Hey,
Would just like to say thanks for this great tut, had a play around and my sites now load MUCH faster.
So thanks a million :D
NTHosts 07-27-2006, 07:18 AM Ok maybe not, it was faster for about 15 minutes then all of a suddon it would take at least 40 seconds to load just a basic html site, so I changed all the files back and it now works fine again :)
sleddog 07-27-2006, 07:39 AM At some point this thread is going to need to be unstickied as the mysql4 and apache1 specific stuff is going to confuse a lot of people. Haven't most distros retired apache 1.x by now? I know it's not in the current testing version of debian they are hardly known for being cutting edge.
No-one is required to use the webserver that ships with a distro. Some people may prefer lighhtpd, others Litespeed. And some, for whatever reason, may prefer Apache 1.x.
Anyone who builds a new server now with old apache is going to be limiting their upgrade path. You don't know that you'll be able to run php6 or the next ruby or phyton on 1x a couple years from now and migrating an operational server is a bitch and half. Right now I'm setting stuff up with mysql5, php5, and apache2 so hopefully I won't have to do any major upgrades for a long time once everything is up and running.
I understand your point, but I think anyone who manually installs Apache 1.x in place of a distro's Apache 2.x presumably has the technical ability to switch when required. It's not that difficult :)
Shaw Networks 07-30-2006, 03:09 AM At some point this thread is going to need to be unstickied as the mysql4 and apache1 specific stuff is going to confuse a lot of people. Haven't most distros retired apache 1.x by now? I know it's not in the current testing version of debian they are hardly known for being cutting edge.
Everyone who runs a production environment web hosting server runs Apache 1.x. Comes by default with cPanel and most other hosting control panels. Your point about Turck MMCache is correct though and I'll have it updated with a good replacement in the near future along with tips for tweaking the httpd.conf for different types of servers.
nomore 07-31-2006, 07:04 PM Thanks for the notice, could a mod update that link with:
http://superb-east.dl.sourceforge.net/sourceforge/turck-mmcache/turck-mmcache-2.4.6.tar.gz
still not working
sleddog 07-31-2006, 07:10 PM Turcke MMCache is no longer maintainer. You should look at its descendent, eAccelerator (http://eaccelerator.net/).
AmishPatel 08-22-2006, 09:59 AM Just wondering - is there an updated version of what was said on the first page for 2006 at all?
duskom 08-23-2006, 02:33 PM Just wondering - is there an updated version of what was said on the first page for 2006 at all?
If you take close look at the post you will see: "Last edited by SoftWareRevue : 03-08-2006 at 04:54 PM. Reason: Updating" at the bottom
AmishPatel 08-27-2006, 11:09 AM Hey guys,
got the server. Could someone post an easy step-by-step guide on how to install eAccelerator?
Dacsoft 08-27-2006, 12:43 PM try this from ssh:
wget http://noc.medialayer.com/ea.txt
change to eaccelerator.sh
run it by sh eacellerator.sh
restart httpd by /scripts/restartsrv_httpd (cpanel)
HD Fanatic 09-02-2006, 08:02 PM nevermind, found the mistake
HD Fanatic 09-02-2006, 08:58 PM how safe is it to tune sysctl.conf ? How would one know if it causes any issues?
firestarter 09-03-2006, 05:19 AM It is always a good idea to tune the sysctl. If there is any issue, it should showup in either of the /var/log/messages or /var/log/secure.
guimaraes83 09-03-2006, 05:21 AM Why do most people use apache 1.x instead of apache 2.x ? Is it due the load?
firestarter 09-03-2006, 05:24 AM Most of the servers here are cPanel based and cPanel is yet to support 2.x
HD Fanatic 09-03-2006, 08:32 PM Most of the servers here are cPanel based and cPanel is yet to support 2.x
I never knew cpanel doesn't support apache 2.x :eek:
sysconfig 09-04-2006, 02:12 AM Configuring Apache
# =================================================
# Basic settings
# =================================================
ServerType standalone
ServerRoot "/usr/local/apache"
PidFile /usr/local/apache/logs/httpd.pid
ScoreBoardFile /usr/local/apache/logs/httpd.scoreboard
ResourceConfig /dev/null
AccessConfig /dev/null
# =================================================
# Performance settings
# =================================================
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 5
MaxSpareServers 10
StartServers 5
MaxClients 150
MaxRequestsPerChild 0
# =================================================
# Apache's modules
# =================================================
ClearModuleList
AddModule mod_log_config.c
AddModule mod_mime.c
AddModule mod_dir.c
AddModule mod_access.c
AddModule mod_auth.c
# =================================================
# General settings
# =================================================
Port 80
User apache
Group apache
ServerAdmin admin@abc.com
UseCanonicalName Off
ServerSignature Off
HostnameLookups Off
ServerTokens Prod
<IfModule mod_dir.c>
DirectoryIndex index.html
</IfModule>
DocumentRoot "/www/vhosts"
# =================================================
# Access control
# =================================================
<Directory />
Options None
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "/www/vhosts/www.testdom.com">
Order allow,deny
Allow from all
</Directory>
<Directory "/www/vhosts/www.test1.net">
Order allow,deny
Allow from all
</Directory>
# =================================================
# MIME encoding
# =================================================
<IfModule mod_mime.c>
TypesConfig /usr/local/apache/conf/mime.types
</IfModule>
DefaultType text/plain
<IfModule mod_mime.c>
AddEncoding x-compress Z
AddEncoding x-gzip gz tgz
AddType application/x-tar .tgz
</IfModule>
# =================================================
# Logs
# =================================================
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
ErrorLog /usr/local/apache/logs/error_log
CustomLog /usr/local/apache/logs/access_log combined
# =================================================
# Virtual hosts
# =================================================
NameVirtualHost *
<VirtualHost *>
DocumentRoot "/www/vhosts/www.testdom.com"
ServerName "www.testdom.com (http://www.testdom.com/)"
ServerAlias "www.e-bank.lab (http://www.e-bank.lab/)"
ErrorLog logs/www.testdom.com/error_log
CustomLog logs/www.testdom.com/access_log combined
</VirtualHost>
<VirtualHost *>
DocumentRoot "/www/vhosts/www.test1.net"
ServerName "www.test1.net (http://www.test1.net/)"
ErrorLog logs/www.test1.net/error_log
CustomLog logs/www.test1.net/access_log combined
</VirtualHost>
Flaxen 09-08-2006, 02:51 PM Is there any major different between the various PHP cache engines like Zend Optimize, MMCache, etc?
Is there any major different between the various PHP cache engines like Zend Optimize, MMCache, etc?
Zend Optimizer only does slight speed-ups and is really there so you can use Zend encoded scripts. They have a commercial product that does the full optimising, but it's expensive like most Zend products.
MMCache is no longer in development, I think the last release was in 2003. Check out eAccelerator, this now uses MMCache code so is probably the best option. They currently only support PHP 4, stable PHP 5.0 support should appear in the next few weeks from what I can tell, with PHP 5.1 after that.
I only use Zend Optimizer at the moment, but will probably install eAccelerator in the coming months, as my high traffic site is starting to overwhelm my server...
Dranoel 09-24-2006, 05:18 AM Thank you for the Tutorial. Will be putting it to use on our servers.
HD Fanatic 09-30-2006, 02:06 AM On the first message of this thread, there are many duplicate entries in the sysctl.conf file, is that ok?
LiquidQuest 09-30-2006, 11:55 PM for some reason, i seem to be the only one who is experiencing this...
im on a brand new box with the following specs
Dual Xeon 3.06
4GB RAM registered
73GB SCSI
CentOS 4.3
WHM
i haven't moved my accounts from the old box to this one yet, but i noticed memory usage go up from an idle 3.4 to a 10.2... and obviously my server load is 0.00 because of no account activity.
i only implemented step #1... nothing else.
anyone know why?
Sam.Serverfreak 10-09-2006, 09:57 AM Please use top to see what process is running and using so much of resources
gee_fin 10-27-2006, 05:21 AM Quick note, if you're using Plesk, you'll want to comment out the
"skip-innodb" line as it crashes the console with the error -
"MySQL query failed: Can't find file: 'misc.MYI'" :)
Well i dont know why but i cannot even make the my.cnf work. I run mysq 3..x.x with plesk. I tried to run the config from this post, but MYSQL will just not start. What are im doing wrong?
Here is my current my.cnf wich workd. Its really poor right? I should optimize it, but the examples doesnt work. Dont know why. My config also has all those set-variable wich i dont see on any other my.cnf. Please help guys.
------------------------
[mysqld]
safe-show-database
innodb_data_file_path=ibdata1:10M:autoextend
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
set-variable=max_connections=300
set-variable=max_user_connections=10
set-variable=max_allowed_packet=1M
set-variable=thread_stack=128K
set-variable=key_buffer=128M
set-variable=table_cache=300
set-variable=record_buffer=8M
set-variable=back_log=100
set-variable=thread_cache_size=4
set-variable=sort_buffer=16M
set-variable=delayed_insert_timeout=150
set-variable=interactive_timeout=40
set-variable=wait_timeout=40
set-variable=connect_timeout=10
[mysql.server]
user=mysql
basedir=/var/lib
[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
digitalracks 12-09-2006, 02:46 PM key_buffer=16M
join_buffer=1M
record_buffer=1M
sort_buffer=2M
What does the M stand for?
duskom 12-09-2006, 03:03 PM M is standing for Megabytes
What about my config, can someone ellaborate? :confused:
digitalracks 12-09-2006, 03:19 PM M is standing for Megabytes
Is the quantity recommended in MB not abit excessive?
duskom 12-09-2006, 03:21 PM Is the quantity recommended in MB not abit excessive?
Depends on amount of Memory you have installed on your server
digitalracks 12-09-2006, 03:39 PM Depends on amount of Memory you have installed on your server
Are they fine for a:
1.7 Ghz P4
Min Ram: 384 MB
Bandwidth: 1.5 Mbps Dedicated
duskom 12-09-2006, 03:56 PM It could be fine, but again if you have a few websites that are MySQL intensive and with a lot of visitors it could be to high. Best way is to put it like that and monitor how your server performs. If it is not too loaded, than it is OK. If you have load problems and poor MySQL performnce try to lower key_buffer and see what is happening. Generaly it could be fine.
madfiddler 12-26-2006, 09:53 AM I got alot of errors with the sysctl.conf additions. Will this be a problem?
net.ipv4.ip_forward = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.lo.accept_source_route = 0
error: 'net.ipv4.conf.eth0.accept_source_route' is an unknown key
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.lo.rp_filter = 1
error: 'net.ipv4.conf.eth0.rp_filter' is an unknown key
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.lo.accept_redirects = 0
error: 'net.ipv4.conf.eth0.accept_redirects' is an unknown key
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.log_martians = 0
net.ipv4.conf.lo.log_martians = 0
error: 'net.ipv4.conf.eth0.log_martians' is an unknown key
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.lo.accept_source_route = 0
error: 'net.ipv4.conf.eth0.accept_source_route' is an unknown key
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.lo.rp_filter = 1
error: 'net.ipv4.conf.eth0.rp_filter' is an unknown key
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.lo.accept_redirects = 0
error: 'net.ipv4.conf.eth0.accept_redirects' is an unknown key
net.ipv4.conf.default.accept_redirects = 0
error: permission denied on key 'kernel.sysrq'
error: permission denied on key 'net.ipv4.tcp_fin_timeout'
error: permission denied on key 'net.ipv4.tcp_keepalive_time'
error: permission denied on key 'net.ipv4.tcp_window_scaling'
error: permission denied on key 'net.ipv4.tcp_sack'
error: permission denied on key 'net.ipv4.tcp_timestamps'
error: permission denied on key 'net.ipv4.tcp_syncookies'
error: permission denied on key 'net.ipv4.icmp_echo_ignore_broadcasts'
error: permission denied on key 'net.ipv4.icmp_ignore_bogus_error_responses'
net.ipv4.conf.all.log_martians = 1
error: permission denied on key 'net.ipv4.tcp_max_syn_backlog'
error: permission denied on key 'net.ipv4.tcp_max_tw_buckets'
error: permission denied on key 'net.ipv4.ip_local_port_range'
Shaw Networks 01-18-2007, 02:27 PM A new section on mod_throttle will be added shortly (waiting for the adds to edit my post). I am also working on adding a section for eAccelerator to replace MMCache.
scribby 01-24-2007, 11:21 AM A new section on mod_throttle will be added shortly (waiting for the adds to edit my post). I am also working on adding a section for eAccelerator to replace MMCache.
Oh I didn't think this thread was going to be updated so I've created a new one with updated info and how to install eAccelerator etc.. http://www.webhostingtalk.com/showthread.php?p=4329285
Hope you don't mind, this thread really helped me back when I was first starting out, just wanted to give something back to the community :blush:
We are getting the following errors after updating sysctl.conf:
error: unknown error 1 setting key 'net.ipv4.conf.all.accept_source_route'
error: unknown error 1 setting key 'net.ipv4.conf.lo.accept_source_route'
error: 'net.ipv4.conf.eth0.accept_source_route' is an unknown key
error: unknown error 1 setting key 'net.ipv4.conf.default.accept_source_route'
error: unknown error 1 setting key 'net.ipv4.conf.all.rp_filter'
error: unknown error 1 setting key 'net.ipv4.conf.lo.rp_filter'
error: 'net.ipv4.conf.eth0.rp_filter' is an unknown key
error: unknown error 1 setting key 'net.ipv4.conf.default.rp_filter'
error: unknown error 1 setting key 'net.ipv4.conf.all.accept_redirects'
error: unknown error 1 setting key 'net.ipv4.conf.lo.accept_redirects'
error: 'net.ipv4.conf.eth0.accept_redirects' is an unknown key
error: unknown error 1 setting key 'net.ipv4.conf.default.accept_redirects'
error: unknown error 1 setting key 'net.ipv4.conf.all.log_martians'
error: unknown error 1 setting key 'net.ipv4.conf.lo.log_martians'
error: 'net.ipv4.conf.eth0.log_martians' is an unknown key
error: unknown error 1 setting key 'net.ipv4.conf.all.accept_source_route'
error: unknown error 1 setting key 'net.ipv4.conf.lo.accept_source_route'
error: 'net.ipv4.conf.eth0.accept_source_route' is an unknown key
error: unknown error 1 setting key 'net.ipv4.conf.default.accept_source_route'
error: unknown error 1 setting key 'net.ipv4.conf.all.rp_filter'
error: unknown error 1 setting key 'net.ipv4.conf.lo.rp_filter'
error: 'net.ipv4.conf.eth0.rp_filter' is an unknown key
error: unknown error 1 setting key 'net.ipv4.conf.default.rp_filter'
error: unknown error 1 setting key 'net.ipv4.conf.all.accept_redirects'
error: unknown error 1 setting key 'net.ipv4.conf.lo.accept_redirects'
error: 'net.ipv4.conf.eth0.accept_redirects' is an unknown key
error: unknown error 1 setting key 'net.ipv4.conf.default.accept_redirects'
error: unknown error 1 setting key 'kernel.sysrq'
error: unknown error 1 setting key 'net.ipv4.tcp_fin_timeout'
error: unknown error 1 setting key 'net.ipv4.tcp_keepalive_time'
error: unknown error 1 setting key 'net.ipv4.tcp_window_scaling'
error: unknown error 1 setting key 'net.ipv4.tcp_sack'
error: unknown error 1 setting key 'net.ipv4.tcp_timestamps'
error: unknown error 1 setting key 'net.ipv4.tcp_syncookies'
error: unknown error 1 setting key 'net.ipv4.icmp_echo_ignore_broadcasts'
error: unknown error 1 setting key 'net.ipv4.icmp_ignore_bogus_error_responses'
error: unknown error 1 setting key 'net.ipv4.conf.all.log_martians'
error: unknown error 1 setting key 'net.ipv4.tcp_max_syn_backlog'
error: unknown error 1 setting key 'net.ipv4.tcp_max_tw_buckets'
error: unknown error 1 setting key 'net.ipv4.ip_local_port_range'
Addititonally, we installed Turck MMCache for PHP but think we will switch to eaccelerator... How do we remove Turck MMCache ?
Thanks for your help!!!
scribby 01-31-2007, 10:30 AM We are getting the following errors after updating sysctl.conf:
error: unknown error 1 setting key 'net.ipv4.conf.all.accept_source_route'
error: unknown error 1 setting key 'net.ipv4.conf.lo.accept_source_route'
error: 'net.ipv4.conf.eth0.accept_source_route' is an unknown key
error: unknown error 1 setting key 'net.ipv4.conf.default.accept_source_route'
error: unknown error 1 setting key 'net.ipv4.conf.all.rp_filter'
error: unknown error 1 setting key 'net.ipv4.conf.lo.rp_filter'
error: 'net.ipv4.conf.eth0.rp_filter' is an unknown key
error: unknown error 1 setting key 'net.ipv4.conf.default.rp_filter'
error: unknown error 1 setting key 'net.ipv4.conf.all.accept_redirects'
error: unknown error 1 setting key 'net.ipv4.conf.lo.accept_redirects'
error: 'net.ipv4.conf.eth0.accept_redirects' is an unknown key
error: unknown error 1 setting key 'net.ipv4.conf.default.accept_redirects'
error: unknown error 1 setting key 'net.ipv4.conf.all.log_martians'
error: unknown error 1 setting key 'net.ipv4.conf.lo.log_martians'
error: 'net.ipv4.conf.eth0.log_martians' is an unknown key
error: unknown error 1 setting key 'net.ipv4.conf.all.accept_source_route'
error: unknown error 1 setting key 'net.ipv4.conf.lo.accept_source_route'
error: 'net.ipv4.conf.eth0.accept_source_route' is an unknown key
error: unknown error 1 setting key 'net.ipv4.conf.default.accept_source_route'
error: unknown error 1 setting key 'net.ipv4.conf.all.rp_filter'
error: unknown error 1 setting key 'net.ipv4.conf.lo.rp_filter'
error: 'net.ipv4.conf.eth0.rp_filter' is an unknown key
error: unknown error 1 setting key 'net.ipv4.conf.default.rp_filter'
error: unknown error 1 setting key 'net.ipv4.conf.all.accept_redirects'
error: unknown error 1 setting key 'net.ipv4.conf.lo.accept_redirects'
error: 'net.ipv4.conf.eth0.accept_redirects' is an unknown key
error: unknown error 1 setting key 'net.ipv4.conf.default.accept_redirects'
error: unknown error 1 setting key 'kernel.sysrq'
error: unknown error 1 setting key 'net.ipv4.tcp_fin_timeout'
error: unknown error 1 setting key 'net.ipv4.tcp_keepalive_time'
error: unknown error 1 setting key 'net.ipv4.tcp_window_scaling'
error: unknown error 1 setting key 'net.ipv4.tcp_sack'
error: unknown error 1 setting key 'net.ipv4.tcp_timestamps'
error: unknown error 1 setting key 'net.ipv4.tcp_syncookies'
error: unknown error 1 setting key 'net.ipv4.icmp_echo_ignore_broadcasts'
error: unknown error 1 setting key 'net.ipv4.icmp_ignore_bogus_error_responses'
error: unknown error 1 setting key 'net.ipv4.conf.all.log_martians'
error: unknown error 1 setting key 'net.ipv4.tcp_max_syn_backlog'
error: unknown error 1 setting key 'net.ipv4.tcp_max_tw_buckets'
error: unknown error 1 setting key 'net.ipv4.ip_local_port_range'
Addititonally, we installed Turck MMCache for PHP but think we will switch to eaccelerator... How do we remove Turck MMCache ?
Thanks for your help!!!
If your on a VPS thats why your getting those errors.
Yes, I am using a VPS. Does that mean I need to fix sysctl.conf or is it ok as is ? If so, what needs to be added or removed ?
Also, how do we remove Turck MMCache for PHP so we can replace it with eAccelerator ?
Thanks for your quick response!!!
I just wanted to add our experience thus far with this optimzation...
We are running a heavily modded version of Joomla, before optimization if we had 50 users online our CPU Utlization was over 10% (ouch). SQL would barf with over 50 users.
After optimization, with 50 users our CPU Utilization is now 0.51% (wow) and this morning we had over 65 users online with no SQL problems!!!
Thank you sooooo much for this awesome guide!
RBBOT 02-17-2007, 08:33 PM Personally I use xcache rather then eaccelerator for caching. However, if I was to recommend which PHP accelerator to put in a guide, I would say APC as that will be shipped as an official part of PHP 6, so using it now will give you a smoother future migration path.
eAccelerator don't work with PHPsuexec and for some other reasons i want PHPsuexec on my server. So what is my options to use instead of eAccelerator. is it Turck MM cache ?
thanks
layer0 03-15-2007, 05:50 PM eAccelerator don't work with PHPsuexec and for some other reasons i want PHPsuexec on my server. So what is my options to use instead of eAccelerator. is it Turck MM cache ?
thanks
No. eAccelerator is basically a fork of Turck MM Cache, so if eAccelerator doesn't work for you, Turck shouldn't be any better.
Shaw Networks 03-15-2007, 09:58 PM No. eAccelerator is basically a fork of Turck MM Cache, so if eAccelerator doesn't work for you, Turck shouldn't be any better.
Very true, and I have tried to get the mods to update my tutorial with a bit on eaccelerator, but it seems that I have run over the post length limit.
orangewebhosting0net 05-03-2007, 12:37 PM Yes i agree thanks alot helped me squeeze that last bit out!!
Im now moving from reseller account to an VPS and this will surely help a lot ( im planning to take it without control panel/managment ).
alru111 05-20-2008, 05:12 PM this doesn't look like a good advise esp about sysctl.conf
After altering sysctl.conf according to this post I am missing 50% of emails sent through website php fucntion. And subjectively overall slower performance.
Viper3773 08-11-2008, 05:23 PM Thx, will come in handy
miltonmiguel 08-20-2008, 04:57 AM Hi, people i have 2 errors,
1. By installing Turck MMCache all goes well until the passage of "make" this command makes this error:
root@srv3 [~/turck-mmcache-2.4.6]# make
/bin/sh /root/turck-mmcache-2.4.6/libtool --mode=compile gcc -I. -I/root/turck-mmcache-2.4.6 -DPHP_ATOM_INC -I/root/turck-mmcache-2.4.6/include -I/root/turck-mmcache-2.4.6/main -I/root/turck-mmcache-2.4.6 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/turck-mmcache-2.4.6/mmcache.c -o mmcache.lo
mkdir .libs
gcc -I. -I/root/turck-mmcache-2.4.6 -DPHP_ATOM_INC -I/root/turck-mmcache-2.4.6/include -I/root/turck-mmcache-2.4.6/main -I/root/turck-mmcache-2.4.6 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/turck-mmcache-2.4.6/mmcache.c -fPIC -DPIC -o .libs/mmcache.o
/root/turck-mmcache-2.4.6/mmcache.c:389: error: conflicting types for 'php_get_uname'
/root/turck-mmcache-2.4.6/mmcache.c:389: note: an argument type that has a default promotion can't match an empty parameter name list declaration
/usr/local/include/php/ext/standard/info.h:87: error: previous declaration of 'php_get_uname' was here
/root/turck-mmcache-2.4.6/mmcache.c: In function 'fixup_zval':
/root/turck-mmcache-2.4.6/mmcache.c:705: error: 'empty_string' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c:705: error: (Each undeclared identifier is reported only once
/root/turck-mmcache-2.4.6/mmcache.c:705: error: for each function it appears in.)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'calc_string':
/root/turck-mmcache-2.4.6/mmcache.c:1229: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'calc_zval_ptr':
/root/turck-mmcache-2.4.6/mmcache.c:1253: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'calc_property_info':
/root/turck-mmcache-2.4.6/mmcache.c:1260: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'calc_hash_int':
/root/turck-mmcache-2.4.6/mmcache.c:1275: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'calc_zval':
/root/turck-mmcache-2.4.6/mmcache.c:1293: error: 'empty_string' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c:1303: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'calc_op_array':
/root/turck-mmcache-2.4.6/mmcache.c:1345: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'calc_class_entry':
/root/turck-mmcache-2.4.6/mmcache.c:1439: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'calc_size':
/root/turck-mmcache-2.4.6/mmcache.c:1484: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'store_string':
/root/turck-mmcache-2.4.6/mmcache.c:1521: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'store_zval_ptr':
/root/turck-mmcache-2.4.6/mmcache.c:1556: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'store_property_info':
/root/turck-mmcache-2.4.6/mmcache.c:1567: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'store_hash_int':
/root/turck-mmcache-2.4.6/mmcache.c:1587: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'store_zval':
/root/turck-mmcache-2.4.6/mmcache.c:1652: error: 'empty_string' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c:1665: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'store_op_array':
/root/turck-mmcache-2.4.6/mmcache.c:1709: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'store_class_entry':
/root/turck-mmcache-2.4.6/mmcache.c:1849: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'mmcache_store_int':
/root/turck-mmcache-2.4.6/mmcache.c:1941: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'restore_zval':
/root/turck-mmcache-2.4.6/mmcache.c:2159: error: 'empty_string' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'mmcache_put':
/root/turck-mmcache-2.4.6/mmcache.c:3416: error: 'align_test' undeclared (first use in this function)
/root/turck-mmcache-2.4.6/mmcache.c: In function 'ps_create_sid_mmcache':
/root/turck-mmcache-2.4.6/mmcache.c:4004: error: 'empty_string' undeclared (first use in this function)
make: *** [mmcache.lo] Error 1
(BIG ERROR)
2. The next mistake is to modify the file "sysctl.conf" I delete everything and put everything you the full text. And at the time the command "/ sbin / sysctl-w" gives me this error:
root@srv3 [~]# /sbin/sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.lo.accept_source_route = 0
error: "net.ipv4.conf.eth0.accept_source_route" is an unknown key
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.lo.rp_filter = 1
error: "net.ipv4.conf.eth0.rp_filter" is an unknown key
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.lo.accept_redirects = 0
error: "net.ipv4.conf.eth0.accept_redirects" is an unknown key
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.log_martians = 0
net.ipv4.conf.lo.log_martians = 0
error: "net.ipv4.conf.eth0.log_martians" is an unknown key
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.lo.accept_source_route = 0
error: "net.ipv4.conf.eth0.accept_source_route" is an unknown key
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.lo.rp_filter = 1
error: "net.ipv4.conf.eth0.rp_filter" is an unknown key
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.lo.accept_redirects = 0
error: "net.ipv4.conf.eth0.accept_redirects" is an unknown key
net.ipv4.conf.default.accept_redirects = 0
error: "Operation not permitted" setting key "kernel.sysrq"
error: "Operation not permitted" setting key "net.ipv4.tcp_fin_timeout"
error: "Operation not permitted" setting key "net.ipv4.tcp_keepalive_time"
error: "Operation not permitted" setting key "net.ipv4.tcp_window_scaling"
error: "Operation not permitted" setting key "net.ipv4.tcp_sack"
error: "Operation not permitted" setting key "net.ipv4.tcp_timestamps"
error: "Operation not permitted" setting key "net.ipv4.tcp_syncookies"
error: "Operation not permitted" setting key "net.ipv4.icmp_echo_ignore_broadcasts"
error: "Operation not permitted" setting key "net.ipv4.icmp_ignore_bogus_error_responses"
net.ipv4.conf.all.log_martians = 1
error: "Operation not permitted" setting key "net.ipv4.tcp_max_syn_backlog"
error: "Operation not permitted" setting key "net.ipv4.tcp_max_tw_buckets"
error: "Operation not permitted" setting key "net.ipv4.ip_local_port_range"
Please helpme!!!
klaver 04-27-2010, 08:44 AM oh wow, that's some very bad sysctl config, no window scaling and sack turned off. What did you try to do? Slowdown your up/download speeds?
<<snipped>>
Michaels75 04-30-2010, 06:22 AM i was wondering that if these same mysql settings can be used for a vps of following specifications?
1.5ghz processor speed
1gb ram
50gb harddisk
cpanel
centos
|