Servers and Hosting Server Issues - Shared, Virtual, and Dedicated Hosting Options.

Reply
 
Thread Tools

  #1  
Old 03-19-2005, 01:33 PM
PerfectSQL PerfectSQL is offline
Server Admin
 
Join Date: Jan 2005
Age: 41
Posts: 182
PerfectSQL will become famous soon enough
Default PHP caching with eAccelerator
There are a number of PHP caching programs available, most offer lack-luster performance or are prohibitively expensive like Zend Accelelerator. MMCache was one of the best for a long time(or the best in my opinion), but the author could not continue development due to other commitments, and as of PHP 4.3.10 is broken: Enter eAccelerator. eAccelerator is a development branch of MMCache with continued development and will support all current and future versions of PHP. The principal upon which PHP caching works is simple, it increases performance of PHP scripts by caching them in compiled state, so that the overhead of compiling is almost completely eliminated.

PHP eAccelerator can be found at the following URL

http://eaccelerator.sourceforge.net/
or
http://sourceforge.net/projects/eaccelerator/

Installation if fairly straight forward..

Download the file to your server from http://prdownloads.sourceforge.net/e...ar.gz?download

i.e ...
# wget http://switch.dl.sourceforge.net/sou...-0.9.2a.tar.gz

extract the archive
# tar zxvf eaccelerator-0.9.2a.tar.gz

change to the source dir
# cd eaccelerator

export the following system var
# export PHP_PREFIX="/usr/local"
(this is the corect location on cpanel servers, some servers it may be in "/usr")

then phpize...
# $PHP_PREFIX/bin/phpize

configure the program...
# ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config

compile the program..
# make

install the program...
# make install

create a temp directory for cached scripts and set the perms..
# mkdir /tmp/eaccelerator
# chmod 0777 /tmp/eaccelerator

edit your php.ini file
# pico -w /usr/local/lib/php.ini
may be located in "/usr/lib/php.ini" on some machines

add the following to the end of your php.ini to install it as a Zend extension

Code:
zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20020429/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/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"
or as a php extension

Code:
extension="/usr/local/lib/php/extensions/no-debug-non-zts-20020429/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/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"
make sure the path to the extension matches the directory it was installed to on your system after running make install.

Restart apache, then make sure it works by viewing your php info it should say...

Quote:
This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with eAccelerator v0.9.2, Copyright (c) 2004-2005 eAccelerator, by eAccelerator
and there will be a section related to eAccelerator

The only setting you ussually need to change is the eaccelerator.shm_size, 16 is standard and fine in most cases, 32 on a large macine, or in the case of TAZ which runs a dedicated web machine we use 64 MB.

We have seen speed increases of up to 400% on some scripts, with a norm being 150 - 200% once the script is cached.

We hope you have found this TAZ tutorial helpfull.
__________________
Server management and optimization at fair prices.
Free Web Hosting for your forums! Free PHP Hosting @ 0000free.com
Reply With Quote
  #2  
Old 03-19-2005, 03:56 PM
Brook Brook is offline
Tazmanian
 
Real Name: ???
Join Date: Feb 2005
Admin Experience: Advanced
Location: UK
Posts: 1,096
Brook has a spectacular aura about
Default
WOW thank you for sharing your trade secrets with us!

Very kind of you!
Reply With Quote
  #3  
Old 03-19-2005, 03:59 PM
Brook Brook is offline
Tazmanian
 
Real Name: ???
Join Date: Feb 2005
Admin Experience: Advanced
Location: UK
Posts: 1,096
Brook has a spectacular aura about
Default
PS I've only just got a dedicated server so am too scared to try it just yet! (have saved it for future reference tho).. Give me a couple of months and I'll give it a go! :-)
Reply With Quote
  #4  
Old 03-20-2005, 01:00 PM
Pluc Pluc is offline
TAZ Rookie
 
Join Date: Mar 2005
Posts: 2
Pluc is on a distinguished road
Default
Hi !

First, i would like to give you a thumbs up for this nice tutorial

But i have a little problem....
In my php info, normally it must show :
Quote:
This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with eAccelerator v0.9.2, Copyright (c) 2004-2005 eAccelerator, by eAccelerator
But i have :

Quote:
This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with eAccelerator v0.9.2, Copyright (c) 2004-2004 eAccelerator, by eAccelerator with Zend Extension Manager v1.0.6, Copyright (c) 2003-2004, by Zend Technologies with Zend Optimizer v2.5.7, Copyright (c) 1998-2004, by Zend Technologies
The end of my php.ini :
Quote:
[Zend]
zend_optimizer.optimization_level=15
zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-2.5.7
zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-2.5.7
zend_extension=/usr/local/Zend/lib/ZendExtensionManager.so
zend_extension_ts=/usr/local/Zend/lib/ZendExtensionManager_TS.so

extension="/usr/local/lib/php/extensions/no-debug-non-zts-20020429/eaccelerator$
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/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"
I have try to install it as a Zend extension, but Apache wont restart.
Now, thats very fast , but i juste want to know if this is normal to have like 2 zend optimiser running ?
I'm a little bit confused about the informations i see in php info !

Thanks

I'm from Quebec, sorry for my english
Reply With Quote
  #5  
Old 03-21-2005, 06:43 AM
PerfectSQL PerfectSQL is offline
Server Admin
 
Join Date: Jan 2005
Age: 41
Posts: 182
PerfectSQL will become famous soon enough
Default
change
Quote:
zend_optimizer.optimization_level=15
to
Quote:
zend_optimizer.optimization_level=0

running both may cause more harm than good.
__________________
Server management and optimization at fair prices.
Free Web Hosting for your forums! Free PHP Hosting @ 0000free.com
Reply With Quote
  #6  
Old 03-21-2005, 06:00 PM
KW802's Avatar
KW802 KW802 is offline
Oooh, something shiny!
 
Real Name: Kevin
Join Date: Jul 2004
Admin Experience: Advanced
Location: Philly
Posts: 917
KW802 is a splendid one to beholdKW802 is a splendid one to beholdKW802 is a splendid one to beholdKW802 is a splendid one to beholdKW802 is a splendid one to beholdKW802 is a splendid one to beholdKW802 is a splendid one to behold
Default
PerfectSQL,

Nice instructions, thank you. I was wondering though if you'd mind going into for a bit on when a person's server is a good candidate for something like this? Is this one of those optimizations that can't hurt even if it's not needed yet or should should installation be held off until really needed?

Thanks,
Kevin
__________________
Sci-Fi Forum | Horror Forum | CinVin
Reply With Quote
  #7  
Old 03-21-2005, 06:08 PM
Brook Brook is offline
Tazmanian
 
Real Name: ???
Join Date: Feb 2005
Admin Experience: Advanced
Location: UK
Posts: 1,096
Brook has a spectacular aura about
Default
I would be grateful if you could suggest any changes required for a not-so-hi-tec server. For eg, a Pentium 3 1Ghz with 256MB RAM (I may expand the ram soon).

Thanks.
Reply With Quote
  #8  
Old 03-21-2005, 07:34 PM
Pluc Pluc is offline
TAZ Rookie
 
Join Date: Mar 2005
Posts: 2
Pluc is on a distinguished road
Default
Quote:
Originally Posted by PerfectSQL
change

to



running both may cause more harm than good.
Thanks
Reply With Quote
  #9  
Old 03-22-2005, 12:33 AM
PerfectSQL PerfectSQL is offline
Server Admin
 
Join Date: Jan 2005
Age: 41
Posts: 182
PerfectSQL will become famous soon enough
Default
Quote:
Originally Posted by Raze
I would be grateful if you could suggest any changes required for a not-so-hi-tec server. For eg, a Pentium 3 1Ghz with 256MB RAM (I may expand the ram soon).

Thanks.
Firstly, I would not run any bigger cache size than 16. Secondly, if you run MySQL on this server I'd review the thread I posted on MySQL tweaking. Mke sure your buffers are not too big, becuase if they are it may cause your memory to swap. I ran a vbulletin with 200 concurrent users a few years back on a Poweredge 800 Mhz p3, with 512 ram .. it actually ran fine most of the time. If your on a budget and wanted to upgrade i'd recomend a bit more am if anything.
__________________
Server management and optimization at fair prices.
Free Web Hosting for your forums! Free PHP Hosting @ 0000free.com
Reply With Quote
  #10  
Old 03-22-2005, 07:25 AM
Brook Brook is offline
Tazmanian
 
Real Name: ???
Join Date: Feb 2005
Admin Experience: Advanced
Location: UK
Posts: 1,096
Brook has a spectacular aura about
Default
Thanks!

And again, there's no wonder you guys have a great reputation, ever so helpful - and we're not even your customers! (yet!)
Reply With Quote
  #11  
Old 03-22-2005, 07:57 AM
Brook Brook is offline
Tazmanian
 
Real Name: ???
Join Date: Feb 2005
Admin Experience: Advanced
Location: UK
Posts: 1,096
Brook has a spectacular aura about
Default
Quote:
Originally Posted by Raze
Thanks!

And again, there's no wonder you guys have a great reputation, ever so helpful - and we're not even your customers! (yet!)
P.s. would buffer sizes would you recommend? (should I ask this on that thread instead? - or you can quote and reply over there if you like as I'll keep a check on it.. :-))
Reply With Quote
  #12  
Old 03-22-2005, 09:59 AM
PerfectSQL PerfectSQL is offline
Server Admin
 
Join Date: Jan 2005
Age: 41
Posts: 182
PerfectSQL will become famous soon enough
Default
Quote:
Originally Posted by Raze
P.s. would buffer sizes would you recommend? (should I ask this on that thread instead? - or you can quote and reply over there if you like as I'll keep a check on it.. :-))
Depends on how many connections you actually have going on. How many sites and online users do you ussually have?
__________________
Server management and optimization at fair prices.
Free Web Hosting for your forums! Free PHP Hosting @ 0000free.com
Reply With Quote
  #13  
Old 03-22-2005, 01:53 PM
Brook Brook is offline
Tazmanian
 
Real Name: ???
Join Date: Feb 2005
Admin Experience: Advanced
Location: UK
Posts: 1,096
Brook has a spectacular aura about
Default
Quote:
Originally Posted by PerfectSQL
Depends on how many connections you actually have going on. How many sites and online users do you ussually have?
The server is host to few static html sites (which use very little bandwidth) and my forum which has around 40 to 50 users online at peak times, but I think this will grow.

Here is my current my.cnf file...

Code:
[mysqld]
skip-innodb
max_connections = 500
key_buffer = 16M
myisam_sort_buffer_size = 64M
join_buffer_size = 1M
read_buffer_size = 1M
sort_buffer_size = 2M
table_cache = 1024
thread_cache_size = 64
wait_timeout = 7200
connect_timeout = 10
tmp_table_size = 32M
max_allowed_packet = 16M
max_connect_errors = 10
query_cache_limit = 1M
query_cache_size = 16M
query_cache_type = 1

[mysqld_safe] 
open_files_limit = 8192

[mysqldump]
quick
max_allowed_packet = 16M

[myisamchk] 
key_buffer = 64M 
sort_buffer = 64M
read_buffer = 16M
write_buffer = 16M
If you need any further info please let me know. And thanks for your help :-)
Reply With Quote
  #14  
Old 03-23-2005, 04:41 AM
Tomek Tomek is offline
TAZ Rookie
 
Join Date: Mar 2005
Admin Experience: Advanced
Location: Germany, Paderborn
Age: 36
Posts: 4
Tomek is on a distinguished road
Default
I would lower the compression level from the default:
Code:
eaccelerator.compress_level="9"
to:
Code:
eaccelerator.compress_level="1"
The value of 9 is the highest compression level. In my opinion it is too high.
Reply With Quote
  #15  
Old 03-23-2005, 12:24 PM
KW802's Avatar
KW802 KW802 is offline
Oooh, something shiny!
 
Real Name: Kevin
Join Date: Jul 2004
Admin Experience: Advanced
Location: Philly
Posts: 917
KW802 is a splendid one to beholdKW802 is a splendid one to beholdKW802 is a splendid one to beholdKW802 is a splendid one to beholdKW802 is a splendid one to beholdKW802 is a splendid one to beholdKW802 is a splendid one to behold
Default
Quote:
Originally Posted by KW802
Nice instructions, thank you. I was wondering though if you'd mind going into for a bit on when a person's server is a good candidate for something like this? Is this one of those optimizations that can't hurt even if it's not needed yet or should should installation be held off until really needed?
PerfectSQL, any thoughts?
__________________
Sci-Fi Forum | Horror Forum | CinVin
Reply With Quote
  #16  
Old 03-23-2005, 12:26 PM
PerfectSQL PerfectSQL is offline
Server Admin
 
Join Date: Jan 2005
Age: 41
Posts: 182
PerfectSQL will become famous soon enough
Default
Quote:
Originally Posted by KW802
PerfectSQL, any thoughts?
Any server that does PHP scripts is a good candidate for this.. I have never seen any ill effects from using a caching application. Actually the only time I have seen any negative is when a new release of php breaks compatability, but I only saw that once with mmcache.
__________________
Server management and optimization at fair prices.
Free Web Hosting for your forums! Free PHP Hosting @ 0000free.com
Reply With Quote
  #17  
Old 03-23-2005, 12:33 PM
Brook Brook is offline
Tazmanian
 
Real Name: ???
Join Date: Feb 2005
Admin Experience: Advanced
Location: UK
Posts: 1,096
Brook has a spectacular aura about
Default
Do you need any more info from me PerfectSQL?
(I posted above, not sure if you missed it :-( )

P.s. shall I post the info in the 'MySQL Server Tweaking Basics' thread instead as it probably belongs there and not this one?
Reply With Quote
  #18  
Old 03-23-2005, 01:11 PM
PerfectSQL PerfectSQL is offline
Server Admin
 
Join Date: Jan 2005
Age: 41
Posts: 182
PerfectSQL will become famous soon enough
Default
Quote:
Originally Posted by Raze
Do you need any more info from me PerfectSQL?
(I posted above, not sure if you missed it :-( )

P.s. shall I post the info in the 'MySQL Server Tweaking Basics' thread instead as it probably belongs there and not this one?
that config is fine as long as you are not lagging at peak usage times. If you are lagging change the read, sort and join buffer sizes to 768k.

Oh I just noticed your sort buffer is 2 megs, drop that to 1.

Also, run the "free" command at the shell prompt during peak time and paste the results here, so we can see how much of your ram is being consumed.
__________________
Server management and optimization at fair prices.
Free Web Hosting for your forums! Free PHP Hosting @ 0000free.com
Reply With Quote
  #19  
Old 03-23-2005, 02:08 PM
Brook Brook is offline
Tazmanian
 
Real Name: ???
Join Date: Feb 2005
Admin Experience: Advanced
Location: UK
Posts: 1,096
Brook has a spectacular aura about
Default
Quote:
Originally Posted by PerfectSQL
that config is fine as long as you are not lagging at peak usage times. If you are lagging change the read, sort and join buffer sizes to 768k.

Oh I just noticed your sort buffer is 2 megs, drop that to 1.

Also, run the "free" command at the shell prompt during peak time and paste the results here, so we can see how much of your ram is being consumed.
Hi PerfectSQl, thanks for getting back to me.

I've brought the sort buffer down to 1 as suggested and have reboot the server. I've also taken a quick 'free' command whilst there were only 24 users online (I'll post another one when we get about 40 or so online...):


Mem: 252944 226384 26560 0 11792 77140
-/+ buffers/cache: 137452 115492
Swap: 522104 0 522104


Here's with 31

Mem: 252944 241980 10964 0 13920 90236
-/+ buffers/cache: 137824 115120
Swap: 522104 936 521168
Reply With Quote
  #20  
Old 03-23-2005, 02:17 PM
KW802's Avatar
KW802 KW802 is offline
Oooh, something shiny!
 
Real Name: Kevin
Join Date: Jul 2004
Admin Experience: Advanced
Location: Philly
Posts: 917
KW802 is a splendid one to beholdKW802 is a splendid one to beholdKW802 is a splendid one to beholdKW802 is a splendid one to beholdKW802 is a splendid one to beholdKW802 is a splendid one to beholdKW802 is a splendid one to behold
Default
Quote:
Originally Posted by PerfectSQL
Any server that does PHP scripts is a good candidate for this.. I have never seen any ill effects from using a caching application. Actually the only time I have seen any negative is when a new release of php breaks compatability, but I only saw that once with mmcache.
In that case it sounds like something I may need/want to play with. Thanks.

One more question if you don't mind.... In another thread The Sandman has mentioned how many scripts were being cached; where would that be viewable?

Thanks,
Kevin
__________________
Sci-Fi Forum | Horror Forum | CinVin
Reply With Quote
Reply

  Admin Zone Forums > The Community Zone > Managing an Online Community > Servers and Hosting





Currently Active Users Viewing this Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Software: Forum Software Olate Articles 20 03-19-2013 12:18 PM
PHP Content Management System Developers Needed Nippoo Community Cooperative 3 02-24-2005 06:00 PM
I'm looking for a bunch of PHP devs for a CMS... Nippoo Chit Chat 2 02-06-2005 03:20 AM
Need help with a php page agiacosa vBulletin 1 01-22-2005 08:56 PM
PHP 5 is out quentin Chit Chat 5 07-14-2004 03:22 PM


 

All times are GMT -4. The time now is 04:26 PM.


Powered by: vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Page generated in 0.11634302 seconds with 13 queries
The Admin Zone © copyright 2003-2014 All Rights Reserved. Content published on The Admin Zone requires permission for reprint.