News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

What is eAccelerator?

Started by [Unknown], September 19, 2005, 01:35:51 AM

Previous topic - Next topic

[Unknown]

First, some background is necessary.  SMF is written in a very portable language called PHP, which is very commonly used for web software.  It has its advantages and disadvantages, and some people prefer it, and some do not.  But, regardless, it is what SMF (not unlike many other packages) requires.

As you know, you upload PHP files to your server, and type the URL to them in your browser.  Instead of seeing the file you uploaded, you see something generated by it - or, rather, by PHP.  You don't have to do anything (except installing PHP) to make this happen - just access the file.  When you do so, the following things happen:

  • The PHP source code (which looks like text) is analyzed and compiled to something the computer can understand; this is called "compiling."
  • The compiled code is ran, and generates output, runs queries, sends emails, etc.
  • Whatever response is generated by PHP is sent to the user (you.)

This is all well and good, and makes many things - like testing - easier.  However, for larger sites, the resources the first step (analyzing the sourecode and compiling it) takes becomes more and more of a problem.  Since this step is always done exactly the same way, it's possible to cache the resulting compiled code (either to disk or to memory) and avoid that first step.

Furthermore, once you start caching the compiled code, you can do one more thing: optimization.  Instead of optimization taking more time than it is worth on every page view, it can take that time only for the first page view, an investment for the future.  Optimization means removing parts of the code known not to be necessary on your server, calculating the result of mathematical equations, and such things.

This is what eAccelerator does for PHP.  There are other competing products available as well, such as Turck MMCache (which eAccelerator, as of this writing, is based on), PHP-Accelerator, Zend Optimizer, and APC.  Some of these only optimize code, or only cache it, or do both.  Currently, we recommend eAccelerator, because in our tests, production usage, and benchmarks it has shown to preform better than the others.  Most of the larger SMF forums use it, to great effect - it has even reversed the effects of a slashdotting.

In addition, SMF 1.1 can take advantage of eAccelerator (and other optimizers/accelerators) for a performance benefit, as well, by way of the caching it exposes to scripts for general data.  But that's for another topic.  Suffice it to say optimizers are good.

If you are on a dedicated server, you can install and test it for yourself.  Installation is fairly easy and straight-forward:

$ wget http://yourmirror.dl.sourceforge.net/sourceforge/eaccelerator/eaccelerator-0.9.3.tar.gz
$ tar xvzf eaccelerator-0.9.3.tar.gz
$ cd eaccelerator-0.9.3
$ /usr/bin/phpize
$ ./configure --enable-eaccelerator=shared --with-eaccelerator-content-caching --with-php-config=/usr/bin/php-config
$ make
$ su
$ mkdir /tmp/eaccelerator
$ chown apache:apache-group /tmp/eaccelerator
$ chmod 1700 /tmp/eaccelerator
$ make install
(the italicized versions will vary on your system; Apache usually runs as "nobody".)

If you're on Windows, binaries are available at www.arnot.info.

After that, you need to add a line to php.ini for it to load this extension.  Typically, the line will look like this:

zend_extension=/path/to/eaccelerator.so

Depending on your platform, it may take a few more tries.  When you have it installed, running:

$ php -v

Will show the version of eAccelerator along with the PHP version.  After restarting Apache, you should see an immediate (although, depending on your server, perhaps not hugely noticeable) improvement in load times.  For more information and more thorough configuration, look at www.eaccelerator.net.

You may also want to check these topics, affected by using eAccelerator:
http://www.simplemachines.org/community/index.php?topic=50227.0
http://www.simplemachines.org/community/index.php?topic=50229.0

-[Unknown]

junglecat

I have a question I've never really gotten a satisfactory answer to.

How compatible are zend and eAccelerator on the same server? Is there any particularly special configurations needed if you run both?

The reason I ask, is because I host some scripts that require zend. If I install eAccelerator, I don't want to break any sites.

I'm particularly interested because I would like to offer free SMF hosting, but I want to be very sure of what I'm doing before I make that offer.
PM me for affordable hosting. I will install your SMF forum with your choice of a theme for FREE.
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
Join us at Christian Discussions 
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~

Elijah Bliss

Excellent stuff. Caching saved me a ton of headaches.

[Unknown]

Quote from: junglecat on September 19, 2005, 01:55:39 AM
I have a question I've never really gotten a satisfactory answer to.

How compatible are zend and eAccelerator on the same server? Is there any particularly special configurations needed if you run both?

That depends on what you mean by Zend, but I would assume you mean Zend Optimizer.

Zend Optimizer does what it says - it's an optimizer.  It does no bytecode caching (that's what I spent so much time talking about.)  It also loads encoded PHP scripts, which is an important feature for some servers to have (unfortuntely, in my opinion.)

Both Zend Optimizer and eAccelerator can work on the same server at the same time.  As far as I know, the only thing you have to keep in mind is that loading eaccelerator.so has to come before the ZendOptimizer.so file.  In other words, you'll have:

zend_extension=/path/to/ZendOptimizer.so

Just make sure eAccelerator is loaded BEFORE ZendOptimizer.so.  To be honest, I've never tried this, but I know a lot of people run them together, and have said this.  It may not be required, but it can't hurt even so.

From the distribution file, less verbose than I:

; eAccelerator is compatible with Zend Optimizer's loader. Zend Optimizer
; must be installed after eAccelerator in php.ini. If you don't use scripts
; encoded with Zend Encoder then we do not recommend you install Zend Optimizer
; with eAccelerator.


QuoteI'm particularly interested because I would like to offer free SMF hosting, but I want to be very sure of what I'm doing before I make that offer.

When offering free hosting, there are a few things you have to take into account:
  - free hosting means hackers can sign up to hack someone else's forum.  This means tighter security, rigorous screening, or both.
  - you'll want to restrict things using open_basedir, disabled_functions, and possibly even safe_mode (and I'd suggest using suExec if you use safe_mode.)

eAccelerator works best when you have a smaller collection of files.  If you have multiple installations of the same version of SMF, I would suggest pointing their $sourcedir's all to the same place.  This will mean that eAccelerator will cache all their files once, taking less memory and resources for the same benefit.  You will definitely want the package manager disabled.

-[Unknown]

junglecat

Quote from: [Unknown] on September 19, 2005, 02:09:58 AMThat depends on what you mean by Zend, but I would assume you mean Zend Optimizer.
Sorry, yes, I meant Zend Optimizer

Quote from: [Unknown] on September 19, 2005, 02:09:58 AMWhen offering free hosting, there are a few things you have to take into account:
  - free hosting means hackers can sign up to hack someone else's forum.  This means tighter security, rigorous screening, or both.
  - you'll want to restrict things using open_basedir, disabled_functions, and possibly even safe_mode (and I'd suggest using suExec if you use safe_mode.)
Yep, that's why I'm hanging out here,  :D I'm trying to learn all this stuff so I'll know what I'm doing. Eventually. 8)
One possibility I was thinking of was to make separate cpanel accounts for each forum to help keep people out of each other's accounts.
BUT I'm deciding on nothing yet until I explore ALL the possibilities.

Quote from: [Unknown] on September 19, 2005, 02:09:58 AMeAccelerator works best when you have a smaller collection of files.  If you have multiple installations of the same version of SMF, I would suggest pointing their $sourcedir's all to the same place.  This will mean that eAccelerator will cache all their files once, taking less memory and resources for the same benefit.  You will definitely want the package manager disabled.
Whoa... GREAT idea (I would never have thought of that on my own).
PM me for affordable hosting. I will install your SMF forum with your choice of a theme for FREE.
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
Join us at Christian Discussions 
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~

Dannii

I don't have "phpize" and can't find out much about it. i'm running on a server:
Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-15 4.1.11-Debian_4-log

I downloaded it fine.. but yeah not sure what to do now.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Compuart

Have you tried to locate phpize by typing
locate phpize
in the shell?
Hendrik Jan Visser
Former Lead Developer & Co-founder www.simplemachines.org
Personal Signature:
Realitynet.nl -> ExpeditieRobinson.net / PekingExpress.org / WieIsDeMol.Com

Dannii

I get nothing with that, so I guess I'll have to install it manually cause debian don't seem to know anything about it. Unless its in a later version of php, cause I'm planning on upgrading anyway.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

zmobie

Thanks for the summary on eAccelerator!

I'm a little concerned about the current state of the project.  On the homepage, the status seems very up in the air.  What's your feelings on that?

Webrunner

I don't have phpize on my server either :(
There is a difference between knowing the path and walking the path.

=========================================
Vrouwen Power! | Sprintweb: No nonsense e-Business consultancy

Webrunner

OK, i installed the php-dev package and now it is there :)
There is a difference between knowing the path and walking the path.

=========================================
Vrouwen Power! | Sprintweb: No nonsense e-Business consultancy

[Unknown]

Quote from: eldacar on September 19, 2005, 06:23:34 AM
I don't have "phpize" and can't find out much about it. i'm running on a server:
Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-15 4.1.11-Debian_4-log

I downloaded it fine.. but yeah not sure what to do now.

You're using rpms, aren't you?  In that case, you need to either compile PHP from source or install php-devel/php-dev/etc.

Quote from: zmobie on September 19, 2005, 10:19:18 AM
Thanks for the summary on eAccelerator!

I'm a little concerned about the current state of the project.  On the homepage, the status seems very up in the air.  What's your feelings on that?

They wanted to start distributing eAccelerator with some other software.  However, the original creator of Turck MMCache was not willing to allow this (and he owns the original copyrights to much of the code.)  They plan to rewrite it, which I agree is dubious, but the current stable version is enough of a benefit.

I'm not sure we will recommend their new version, though - I won't until I see that it's as good as their current.  So, for now, I suggest the usage of 0.9.3.

-[Unknown]

Dannii

I got phpize now. It displays this:
QuoteConfiguring for:
PHP Api Version:         20020918
Zend Module Api No:      20020429
Zend Extension Api No:   20021010
And then stops. do you know what could be causing that?
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

[Unknown]

That's all phpize should do.  It's done its job, now on to the next step (configure)!

-[Unknown]

Dannii

But should it take me back to the command prompt (it does not at the moment)? Or do i just type the configure lines without the prompt?
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

[Unknown]

Try hitting enter.  The phpize command may take a few seconds to finish.

-[Unknown]

Dannii

A few minutes on this old computer :P

I'm pretty sure I have it all installed correctly, but i don't know if I have it correctly in php.ini
What's the easiest way to check if it's running?
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

boogiedown

what do i relace here? chown apache:apache-group /tmp/eaccelerator and with what?

Ben_S

What does your apache run as?
Liverpool FC Forum with 14 million+ posts.

boogiedown

#19
ok, got it "nobody"

Advertisement: