We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

EE web server tuning

Development and Programming

digitalformula's avatar
digitalformula
176 posts
14 years ago
digitalformula's avatar digitalformula

Hi all,

Does anyone know where I’d be able to get some advice about tuning an Apache web server (Debian) to run EE as efficiently as possible?

My production server is hosted externally - EE says it’s using around 5MB of memory in the output profiler when accessing the EE system homepage.

My development server says it’s using around 10MB of memory on the EE system homepage.

When browsing the site itself, the homepage on the production server says EE is using around 9MB of memory. The dev server says it’s using around 14MB of memory on the site’s homepage. The jump in memory usage seems to be after the inclusion of the module files (somewhat understandable).

Can anyone help or point me in the direction of someone that can? (Yes, I’ve read http://ellislab.com/blog/entry/troubleshooting_site_performance_issues/)

Thanks!

       
digitalformula's avatar
digitalformula
176 posts
14 years ago
digitalformula's avatar digitalformula

… nobody?

       
John Henry Donovan's avatar
John Henry Donovan
12,339 posts
14 years ago
John Henry Donovan's avatar John Henry Donovan

digitalformula,

Those numbers sound about right. On my local install its about 6-7MB on my system homepage and abotu 10MB on the front-end homepage

What version and build of EE are you using? What add-ons are you using?

Is the memory the only thing you are concerned about or is the site speed slow? Out of our blog article what have you tried?

Are you on shared hosting or a dedicated box?

       
digitalformula's avatar
digitalformula
176 posts
14 years ago
digitalformula's avatar digitalformula
digitalformula, Those numbers sound about right. On my local install its about 6-7MB on my system homepage and abotu 10MB on the front-end homepage

Mine’s higher on the homepage by about 4MB, though. 😊

What version and build of EE are you using?

I’m running EE 2.2.1 build 20110705.

What add-ons are you using?

Hmmm, a few. I’m using FreeForm from SolSpace, Low NoSpam, NSM Morphine, Low Seg2Cat, QuickSave, Allow EE Code, Simple Pagination and Twitter Timeline. All others are add-ons supplied with and pre-enabled in a default EE installation.

Is the memory the only thing you are concerned about or is the site speed slow?

The performance isn’t a worry right now as it’s only a development server and I’m therefore the only person using it. My question was more around why a ‘new’ dev server could use 50% more memory than the production one.

Out of our blog article what have you tried?

A few things. I’ve become scarily familiar with the output profiler, I don’t use nested queries, I have embeds only where they’re absolutely needed (all others are global vars or snippets, as appropriate), I’ve added the disable= parameter to all my entries tags where appropriate, I’m not using any relationships (the production site DOES, and uses less memory) and there isn’t any PHP in my templates.

In addition, I don’t have a single add-on enabled that I don’t need. I read the documentation for every single add-on that ships with EE and have disabled every one that I don’t explicitly need, including a bunch that are enabled by default but that I don’t use.

Also, InnoDB is disabled on my MySQL server, the table_cache and page_cache_size_limit settings have been changed (although they make no difference), PHP runs as CGI instead of an Apache module, I’m using the worker MPM in Apache, there are no modules running on my Apache server that aren’t needed, I’m using content compression and have content cache enabled.

Are you on shared hosting or a dedicated box?

I’m using a 256MB slice from SliceHost which, I believe, is technically ‘dedicated’, despite being run under a Xen virtualisation environment. It’s my server and I can do as I want with it i.e. reboot, configure, erase, whatever.

In a physical sense, it’s not dedicated, though, if that’s what you mean.

Also, I’ve been involved in a long discussion with my production host and they’ve provided a ton of info about what their configuration is. My production site is shared hosting and actually doesn’t have most of the performance-enhancing changes I’ve made. Note, however, that the memory usage was the same before I made these changes to the dev server - they’ve been made with a view to tuning the new production server at some stage (it’s not running yet).

       
lehrerfreund's avatar
lehrerfreund
263 posts
14 years ago
lehrerfreund's avatar lehrerfreund

digitalformula,

I think it seriously depends on the use of cached templates and tags. Maybe you have turned caching off on the one server and caching on on the other?

Example: A page from my site is using 7 MB when all cache on, when the cache is empty it uses 22 MB.

       
digitalformula's avatar
digitalformula
176 posts
14 years ago
digitalformula's avatar digitalformula
digitalformula, I think it seriously depends on the use of cached templates and tags. Maybe you have turned caching off on the one server and caching on on the other? Example: A page from my site is using 7 MB when all cache on, when the cache is empty it uses 22 MB.

lehrerfreund,

That’s what I thought, initially. However, I’ve got this in my cache configuration:

CacheEnable mem /

That, according to the mem_cache documentation, will enable caching for the root of the site and all levels below it (with the exception of requests that require authorization).

Can I test somehow that caching is working? I’ve got logging setup as per http://blog.josepruano.com/2008/04/logging-apaches-cache-modules.html - here are the last few lines of performance.log:

[11/Jul/2011:23:29:57 +0000] "GET /images/_ui/site-thumbs/site-fc.jpg HTTP/1.1" + "D=279 t=1310426997563889" "D=282 t=1310426997563889" 304
[11/Jul/2011:23:29:57 +0000] "GET /images/_ui/site-thumbs/site-df.jpg HTTP/1.1" + "D=246 t=1310426997565243" "D=249 t=1310426997565243" 304
[11/Jul/2011:23:29:57 +0000] "GET /images/_ui/list-bullet.png HTTP/1.1" + "D=237 t=1310426997576922" "D=240 t=1310426997576922" 304
[11/Jul/2011:23:29:57 +0000] "GET /images/_ui/bottom-bar-background.jpg HTTP/1.1" + "D=308 t=1310426997585226" "D=311 t=1310426997585226" 304
[11/Jul/2011:23:29:55 +0000] "GET / HTTP/1.1" + "D=238691 t=1310426995155572" "D=238698 t=1310426995155572" 200
[11/Jul/2011:23:29:59 +0000] "GET /scripts/lightbox/themes/default/images/jquery-lightbox-theme.png HTTP/1.1" + "D=398 t=1310426999148229" "D=401 t=1310426999148229" 304

I’m assuming the “+” symbols indicate cache hits …

Re caches templates and tags, I’m not using any specific template or tag caching on either server (although I’m aware of EE’s ability to do so).

       
digitalformula's avatar
digitalformula
176 posts
14 years ago
digitalformula's avatar digitalformula

By the way, memory usage is now up to almost 17MB on the homepage. For what it’s worth, the dev server always has an EE total execution time of around the same or less than the production server.

       
lehrerfreund's avatar
lehrerfreund
263 posts
14 years ago
lehrerfreund's avatar lehrerfreund

Did you already try to set the template-debugging to on (admin -> system administration -> output and debugging) and compare the two environments?

       
digitalformula's avatar
digitalformula
176 posts
14 years ago
digitalformula's avatar digitalformula
Did you already try to set the template-debugging to on (admin -> system administration -> output and debugging) and compare the two environments?

Yes and the biggest jumps are at the following lines. Here is production:

(0.011265 / 4.53MB) Including Files for Plugins and Modules
(0.033104 / 6.08MB) Files for Plugins and Modules All Included

That’s 1.55MB increase in memory usage.

Here is dev:

(0.008228 / 8.14MB) Including Files for Plugins and Modules
(0.028752 / 10.84MB) Files for Plugins and Modules All Included.

That’s 2.7MB increase in memory usage.

Here is production, further down:

(0.034272 / 6.09MB) -> Method Called: entries
(0.059692 / 7.34MB) Calling Extension Class/Method: Matrix_ext/channel_entries_tagdata
(0.069703 / 7.54MB) -> Data Returned

That’s 0.2MB increase in memory usage.

Here is the same section on dev (yes, I’m aware that Matrix isn’t enabled on dev, but, if anything, that should mean less memory usage):

(0.029870 / 10.88MB) -> Method Called: entries
(0.054329 / 12.92MB) -> Data Returned

That’s 2.04MB increase in memory usage.

The jumps in memory usage are odd, to me at least. I’ve also just rebooted the web server and the first load of the homepage already shows that EE is using very close to 18MB.

       
digitalformula's avatar
digitalformula
176 posts
14 years ago
digitalformula's avatar digitalformula

I also just learned that Apache and MySQL run on the same shared virtual server at my production host, too. The hosting company tells me that the shared virtual server can host between 500 and 1000 sites at any time … wow.

       
digitalformula's avatar
digitalformula
176 posts
14 years ago
digitalformula's avatar digitalformula

After some testing I’ve found that the server is definitely using less memory overall if it’s running the worker MPM (libapache2-mpm-worker) and running PHP as CGI instead of the libapache2-mod-php5 module.

Here’s some output from ‘free -m’ on Debian. The two numbers are used and free memory in MB, respectively.

With the prefork MPM and PHP5 Apache module:

-/+ buffers/cache:         72        172

With the worker MPM and PHP5 running as CGI binary:

-/+ buffers/cache:         46        198

In both cases, swap is 0.

However, EE uses almost exactly the same memory regardless of which combination is running above.

Can anyone comment on the memory usage difference between Apache 1.3 and 2.2?

       
Kevin Smith's avatar
Kevin Smith
4,784 posts
14 years ago
Kevin Smith's avatar Kevin Smith

Hi digitalformula,

Since this is a question far more related to server administration, I’m moving this thread over to the Development and Programming forum so that others who might be tweaking their servers can see this thread and join in.

       
digitalformula's avatar
digitalformula
176 posts
14 years ago
digitalformula's avatar digitalformula

Not sure if anyone else is following this thread but as a point of interest I decided to start my server from an empty shell (no pun intended) and see how things went.

I compiled Apache, PHP and MySQL from source, making sure to only select configuration options that I really needed. While building Apache, I found that the following command reduced the httpd binary size from around 2.3MB down to ~600KB.

export CFLAGS="-Os -fomit-frame-pointer -s"

For those familiar with this sort of thing, I believe that option is well-known to produce small binaries but can also produce binaries that are ever-so-slightly slower. ‘-Os’ can be replaced with ‘O3’ to create slightly bigger, but faster, binaries.

After that I basically tuned the balls off Apache and MySQL by following a number of guides I found online. the whole installation is now using 76MB of memory and EE is using just under 9MB memory (on production it uses slightly more).

The overall memory footprint could be further reduced by using the Apache 2.2 ‘prefork’ MPM and PHP as a module - on mine I’m using the worker MPM and running PHP as a CGI.

Not a bad result, really …

       
digitalformula's avatar
digitalformula
176 posts
14 years ago
digitalformula's avatar digitalformula
Not sure if anyone else is following this thread but as a point of interest I decided to start my server from an empty shell (no pun intended) and see how things went. <snip>

Although as soon as I run any EE tags, I’ve found that the memory usage shoots back up to what it was before … sigh. This is doing my head in.

       
budulay's avatar
budulay
6 posts
14 years ago
budulay's avatar budulay

try to install eaccelerator and nginx as frontend

       
1 2

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.