Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sun Jul 22, 2012 10:49 am 
Offline
Senior Member

Joined: Wed Jun 27, 2012 10:00 pm
Posts: 87
Website: http://hemonc.org/wiki/Main_Page
Hi, I installed a basic LAMP (Ubuntu 12.04 LTS, Apache 2.2.22, MySQL 5.5.24, PHP 5.3.10), and am running a MediaWiki installation here in addition to some mostly static content. Things are running fine since my traffic is modest, but I'd be interested in implementing whatever basic performance optimizations almost everybody should be running so users have a better experience.

For example, my MediaWiki page cut about 200ms off the ping of a page that needed to query the database after enabling PHP APC--as compared to no caching. Some of the Apache modules installed include:
-cloudflare_module
-deflate_module; installed by default, but I have not configured anything, so I'm not sure if it's actually sending compressed output
-expires_module; installed, and I tried to configure via /etc/apache2/sites-available/domain.com with "access plus 7 days" configuration, but it doesn't seem to have made an appreciable difference
-include_module
-rewrite_module

Suggestions for whatever modules and performance tweaks you always do would be very welcome--thanks!

_________________
Amateur, eager to learn.
My hematology, oncology, and chemotherapy regimen wiki


Top
   
PostPosted: Sun Jul 22, 2012 11:45 am 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
Since you're running Ubuntu 12.04, you can use PHP-FPM to move PHP processing out of Apache. This is generally a very good idea.

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
PostPosted: Sun Jul 22, 2012 12:02 pm 
Offline
Junior Member

Joined: Tue Sep 25, 2007 3:04 pm
Posts: 27
Caching. Why load dynamic modules when the content you are generating is staying static? This should vastly improve page load times and reduce i/o, memory, and CPU footprints.


Top
   
PostPosted: Sun Jul 22, 2012 4:48 pm 
Offline
Senior Member

Joined: Wed Jun 27, 2012 10:00 pm
Posts: 87
Website: http://hemonc.org/wiki/Main_Page
hoopycat wrote:
Since you're running Ubuntu 12.04, you can use PHP-FPM to move PHP processing out of Apache. This is generally a very good idea.
Thanks. I'm giving it a shot, but I've misconfigured something. I've tried referring to the guides at
http://www.howtoforge.com/using-php5-fp ... -12.04-lts and http://alexcabal.com/installing-apache- ... -maverick/. Here are the steps I used:

sudo apt-get install libapache2-mod-fastcgi php5-fpm php5
sudo a2enmod actions fastcgi alias
sudo service apache2 restart
sudo nano /etc/apache2/sites-available/dryang.org

inserted this between <VirtualHost *:80> and </VirtualHost>:

<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization
</IfModule>

-------------
Alternatively, I've also tried:

FastCgiExternalServer /srv/www/dryang.org/public_html/php5.external -host 127.0.0.1:9000
AddHandler php5-fcgi .php
Action php5-fcgi /usr/lib/cgi-bin/php5.external
Alias /usr/lib/cgi-bin/ /srv/www/dryang.org/public_html/

-------------

However, with either one, I still get "Server API: Apache 2.0 Handler." Can anyone pick out what mistake I've made? apache2ctl -M lists fastcgi_module (shared), so it seems that it's enabled, just not configured to be used.

ps aux shows that things are loaded up:
Code:
root     28362  0.0  0.7  77060  3928 ?        Ss   16:07   0:00 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
www-data 28363  0.0  0.6  77060  3120 ?        S    16:07   0:00 php-fpm: pool www
www-data 28364  0.0  0.6  77060  3120 ?        S    16:07   0:00 php-fpm: pool www
www-data 28365  0.0  0.6  77060  3120 ?        S    16:07   0:00 php-fpm: pool www
www-data 28366  0.0  0.6  77060  3120 ?        S    16:07   0:00 php-fpm: pool www
www-data 28528  0.0  0.7  31456  4044 ?        S    16:34   0:00 /usr/sbin/fcgi-pm -k start


/var/log/php5-fpm.log shows:
Code:
[22-Jul-2012 16:08:00] NOTICE: fpm is running, pid 28362
[22-Jul-2012 16:08:00] NOTICE: ready to handle connections


Edit: Success! Thanks to heckman in IRC for pointing out that I needed to disable mod_php:
Code:
sudo a2dismod php5

Using the "Alternatively, I've also tried" lines and restarting Apache results in: Server API: FPM/FastCGI.

A-KO wrote:
Caching. Why load dynamic modules when the content you are generating is staying static? This should vastly improve page load times and reduce i/o, memory, and CPU footprints.
Yep, I'd love to implement additional caching, but I don't know which direction to turn to. Is there a specific implementation or guide that you can suggest?

Thank you for your help!

_________________
Amateur, eager to learn.
My hematology, oncology, and chemotherapy regimen wiki


Top
   
PostPosted: Tue Jul 24, 2012 8:56 am 
Offline
Junior Member
User avatar

Joined: Wed Nov 16, 2011 11:41 am
Posts: 37
Website: http://empoweringmedia.com
Location: United States
What's the best way to optimize apache? By not using it. If you start getting any decent amount of traffic usually apache starts to fall apart.

If you need a drop in apache replacement I recommend Litespeed. Which is a commercial product.

Otherwise ngnx or lighttpd are other good options.

_________________
Larry Ludwig
Empowering Media
Managed Cloud Services and Managed VPS


Top
   
PostPosted: Thu Sep 27, 2012 3:03 pm 
Offline

Joined: Thu Sep 27, 2012 2:53 pm
Posts: 1
yaz wrote:

Edit: Success! Thanks to heckman in IRC for pointing out that I needed to disable mod_php:
Code:
sudo a2dismod php5

Using the "Alternatively, I've also tried" lines and restarting Apache results in: Server API: FPM/FastCGI.

Thank you for your help!


Hi
Can you tell me how you disabled mod_php? I tried Googling and I found a website that explained how to do it, but when I tried their instructions, it did not work. I also noticed it is in a different language, so I may have to use someone's
translation services to translate it to English.


Last edited by helloball on Mon Oct 15, 2012 1:55 pm, edited 1 time in total.

Top
   
PostPosted: Thu Sep 27, 2012 4:12 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
empoweringmedia wrote:
If you start getting any decent amount of traffic usually apache starts to fall apart.

Define "decent".

With a properly configured LAMP stack, Apache does ok.

_________________
Either provide enough details for people to help, or sit back and listen to the crickets chirp.
Security thru obscurity is a myth - and really really annoying.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
RSS

Powered by phpBB® Forum Software © phpBB Group