Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 27th August 2012, 17:03
cbj4074 cbj4074 is offline
Senior Member
 
Join Date: Nov 2010
Posts: 392
Thanks: 29
Thanked 58 Times in 50 Posts
Default ModPHP performance is good, FastCGI is not: Resource limit? Lock? Race condition?

Hello,

I have posed this question to the Apache mailing list and nobody seems to have any insight ( http://mail-archives.apache.org/mod_...torrent.org%3E ). Perhaps somebody here will be able to help.

I'm wrestling with an issue that has been unusually difficult for me to troubleshoot.

I believe to have reduced the root cause to executing PHP sripts with ModPHP vs. FastCGI.

Basically, I have an HTML document (generated via PHP, which isn't necessarily relevant) that includes several external CSS and JavaScript files. These files are included via standard HTML markup:

Code:
 <link rel="stylesheet" type="text/css" href="/auxiliary/css.php?file=global.css" /> 

<script type="text/javascript" src="/auxiliary/js.php?file=global.js"></script>
The only aspect of these URLs that is "unusual" is the dynamic file name is that is appended in the query string. These PHP files (css.php and js.php) are wrapper scripts that fetch template code (CSS and JS, respectively), based on the "file" query string value and respond with valid CSS and JS output.

The nature of the problem is that when several concurrent calls are made to either of the wrapper scripts (when running in FastCGI mode), such as when 4 or 5 CSS or JS files need to be embedded into the HTML page, the responses take far too long to be received in the vast majority of cases.

I have profiled the scripts with xdebug and every request requires less than 0.2 seconds of PHP processing-time. Yet, when I inspect the GET request timeline, via Firebug's Net tab (in Firefox), the response times for these requests are often 1.2 - 1.4 seconds.

The following image displays a side-by-side comparison of a typical timeline when the PHP scripts (css.php and js.php) are executed in ModPHP mode (shown on the left) vs. FastCGI mode (shown on the right).

[Please see attached file.]

Clearly, the CSS and JS file sizes have no bearing on how much time the responses require. And given that the xdebug profiling data indicates that PHP is spending only 0.1 - 0.2 seconds for each request, I am lead to conclude that the problem is with Apache's configuration.

An interesting point of note is that the right-hand (FastCGI) side of the image contains response times that alternate between 1.26s, 303ms, and 1.32s. Why the alternation?

I seem to be hitting a CGI resource limit or some kind of locking or race-condition.

I would very much appreciate insight from anybody who may know what's causing this behavior.
Attached Images
 
Reply With Quote
Sponsored Links
 

Bookmarks

Tags
apache2, fastcgi, modphp

Thread Tools
Display Modes

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
Only Problems since Updating from 3.0.3.3 to 3.0.4.1 mbay General 4 17th May 2012 12:56
Need help with ISPConfig Mail and Squirrelmail m.xander Installation/Configuration 109 3rd February 2012 00:15
Attacks on MTA dclardy Installation/Configuration 4 29th September 2009 16:50
slow download through webserver problem snewp Technical 14 9th May 2008 05:25
Installation Big issue OpenVZ VPS jbond007 Installation/Configuration 3 7th March 2006 19:40


All times are GMT +2. The time now is 10:20.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.