You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by howard chen <ho...@gmail.com> on 2008/02/18 08:49:09 UTC
[users@httpd] Server Side Include (SSI) is slower than PHP ?
Hello,
I am running Apache/2.2.6 on Windows XP, testing on a very simple
include testes, e.g.
SSI
===
<!--#include virtual="modules/1.html" -->
<!--#include virtual="modules/2.html" -->
<!--#include virtual="modules/3.html" -->
<!--#include virtual="modules/4.html" -->
<!--#include virtual="modules/5.html" -->
PHP
===
<?php
include("./modules/1.html");
include("./modules/2.html");
include("./modules/3.html");
include("./modules/4.html");
include("./modules/5.html");
?>
I was surprised that PHP is faster, i.e.
ab -n 2000 -c 10 http://localhost/benchmark.php => 99 reqs/sec
ab -n 2000 -c 10 http://localhost/benchmark.shtml => 61 reqs/sec
my PHP version is 5.2.5, and even don't have any code cache libraries
(e.g. APC/eA) installed.
Is it normal?
Howard
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Server Side Include (SSI) is slower than PHP ?
Posted by 赵志桐 <op...@gmail.com>.
howard chen 写道:
> On Mon, Feb 18, 2008 at 9:03 PM, Vincent Bray <no...@gmail.com> wrote:
>
>> On 18/02/2008, howard chen <ho...@gmail.com> wrote:
>> > I am running Apache/2.2.6 on Windows XP, testing on a very simple
>> > include testes, e.g.
>> >
>> > SSI
>> > ===
>> >
>> > <!--#include virtual="modules/1.html" -->
>> > <!--#include virtual="modules/2.html" -->
>> > <!--#include virtual="modules/3.html" -->
>> > <!--#include virtual="modules/4.html" -->
>> > <!--#include virtual="modules/5.html" -->
>>
>> These kinds of includes cause Apache to run an internal redirect for
>> each included file. This is just a guess but if your server has
>> AllowOverride set to something other than None and your DocumentRoot
>> is /deeply/buried then Apache must stat() for a large number of
>> .htaccess files. In this case, <number of includes> * <depth of
>> DocumentRoot>.
>>
>> Php on the other hand just reads the files directly.
>>
>> --
>> noodl
>>
>>
>
> Hello,
>
> I have already set AllowOverride to None in my test. I am not sure if
> this issue is related to Windows' Apache or not, so tomorrow I will
> run the test on my CentOS5.
>
> I agree these testes might not reflect the real world suitatons, but I
> was a little bit surprised since most people use SSI for simple file
> inclusions.
>
>
> Howard.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>
i don't know where need SSI to do .
--
---------------------
Regards,
Zachary . aBBISh
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Server Side Include (SSI) is slower than PHP ?
Posted by howard chen <ho...@gmail.com>.
On Mon, Feb 18, 2008 at 9:03 PM, Vincent Bray <no...@gmail.com> wrote:
> On 18/02/2008, howard chen <ho...@gmail.com> wrote:
> > I am running Apache/2.2.6 on Windows XP, testing on a very simple
> > include testes, e.g.
> >
> > SSI
> > ===
> >
> > <!--#include virtual="modules/1.html" -->
> > <!--#include virtual="modules/2.html" -->
> > <!--#include virtual="modules/3.html" -->
> > <!--#include virtual="modules/4.html" -->
> > <!--#include virtual="modules/5.html" -->
>
> These kinds of includes cause Apache to run an internal redirect for
> each included file. This is just a guess but if your server has
> AllowOverride set to something other than None and your DocumentRoot
> is /deeply/buried then Apache must stat() for a large number of
> .htaccess files. In this case, <number of includes> * <depth of
> DocumentRoot>.
>
> Php on the other hand just reads the files directly.
>
> --
> noodl
>
Hello,
I have already set AllowOverride to None in my test. I am not sure if
this issue is related to Windows' Apache or not, so tomorrow I will
run the test on my CentOS5.
I agree these testes might not reflect the real world suitatons, but I
was a little bit surprised since most people use SSI for simple file
inclusions.
Howard.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Server Side Include (SSI) is slower than PHP ?
Posted by Vincent Bray <no...@gmail.com>.
On 18/02/2008, howard chen <ho...@gmail.com> wrote:
> I am running Apache/2.2.6 on Windows XP, testing on a very simple
> include testes, e.g.
>
> SSI
> ===
>
> <!--#include virtual="modules/1.html" -->
> <!--#include virtual="modules/2.html" -->
> <!--#include virtual="modules/3.html" -->
> <!--#include virtual="modules/4.html" -->
> <!--#include virtual="modules/5.html" -->
These kinds of includes cause Apache to run an internal redirect for
each included file. This is just a guess but if your server has
AllowOverride set to something other than None and your DocumentRoot
is /deeply/buried then Apache must stat() for a large number of
.htaccess files. In this case, <number of includes> * <depth of
DocumentRoot>.
Php on the other hand just reads the files directly.
--
noodl
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Server Side Include (SSI) is slower than PHP ?
Posted by howard chen <ho...@gmail.com>.
On Feb 18, 2008 11:22 PM, howard chen <ho...@gmail.com> wrote:
>
> On Mon, Feb 18, 2008 at 10:47 PM, Nick Kew <ni...@webthing.com> wrote:
> > On Mon, 18 Feb 2008 15:49:09 +0800
> >
> > "howard chen" <ho...@gmail.com> wrote:
> >
> >
> > > SSI
> > > ===
> > >
> > > <!--#include virtual="modules/1.html" -->
> > > <!--#include virtual="modules/2.html" -->
> > > <!--#include virtual="modules/3.html" -->
> > > <!--#include virtual="modules/4.html" -->
> > > <!--#include virtual="modules/5.html" -->
> >
> > There is a subrequest per include, so SSI gets slower
> > as the number of includes increases.
> >
>
>
> I also believe this could be probably the reasons behind. I haven;t
> look into the code of SSI so I am not sure if Apache will have some
> kind of caching if files to be included remain unchanged. Or will
> Apache parse the SSI file every time?
>
> I agreed that these benchmark is theoretical only, but just get me surprised.
>
> Howard.
Hello all,
Some findings:
http://people.apache.org/~sctemme/ApconUS2006/WE18/WE18_Performance_Up.ppt
Server-side Includes
- They break sendfile()
This should be the reason I think.
Howard
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Server Side Include (SSI) is slower than PHP ?
Posted by howard chen <ho...@gmail.com>.
On Mon, Feb 18, 2008 at 10:47 PM, Nick Kew <ni...@webthing.com> wrote:
> On Mon, 18 Feb 2008 15:49:09 +0800
>
> "howard chen" <ho...@gmail.com> wrote:
>
>
> > SSI
> > ===
> >
> > <!--#include virtual="modules/1.html" -->
> > <!--#include virtual="modules/2.html" -->
> > <!--#include virtual="modules/3.html" -->
> > <!--#include virtual="modules/4.html" -->
> > <!--#include virtual="modules/5.html" -->
>
> There is a subrequest per include, so SSI gets slower
> as the number of includes increases.
>
I also believe this could be probably the reasons behind. I haven;t
look into the code of SSI so I am not sure if Apache will have some
kind of caching if files to be included remain unchanged. Or will
Apache parse the SSI file every time?
I agreed that these benchmark is theoretical only, but just get me surprised.
Howard.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Server Side Include (SSI) is slower than PHP ?
Posted by Nick Kew <ni...@webthing.com>.
On Mon, 18 Feb 2008 15:49:09 +0800
"howard chen" <ho...@gmail.com> wrote:
> SSI
> ===
>
> <!--#include virtual="modules/1.html" -->
> <!--#include virtual="modules/2.html" -->
> <!--#include virtual="modules/3.html" -->
> <!--#include virtual="modules/4.html" -->
> <!--#include virtual="modules/5.html" -->
There is a subrequest per include, so SSI gets slower
as the number of includes increases.
> PHP
> ===
>
> <?php
>
> include("./modules/1.html");
> include("./modules/2.html");
> include("./modules/3.html");
> include("./modules/4.html");
> include("./modules/5.html");
>
> ?>
There is no per-request overhead other than sending you the
files themselves (which the operating will cache if they're
being frequently requested).
> I was surprised that PHP is faster, i.e.
>
> ab -n 2000 -c 10 http://localhost/benchmark.php => 99 reqs/sec
> ab -n 2000 -c 10 http://localhost/benchmark.shtml => 61 reqs/sec
That seems slow to me. At least if you have hardware that was
new anytime in the last ten years.
In any case, with a real browser (and on the 'net in general -
this doesn't rely on one user continually requesting a testpage),
that'll be dwarfed by cacheing effects. The XBitHack will get
you that with SSI. With PHP, it's up to your script.
--
Nick Kew
Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Server Side Include (SSI) is slower than PHP ?
Posted by Scott Courtney <sc...@sinenomine.net>.
On Monday 18 February 2008 02:49:09 howard chen wrote:
> I was surprised that PHP is faster, i.e.
>
> ab -n 2000 -c 10 http://localhost/benchmark.php => 99 reqs/sec
> ab -n 2000 -c 10 http://localhost/benchmark.shtml => 61 reqs/sec
>
> my PHP version is 5.2.5, and even don't have any code cache libraries
> (e.g. APC/eA) installed.
I haven't run this kind of test recently, because the sites I work on mostly
are complex enough (typically intranet rather than internet) that performance
constraints are in the business application rather than the web layer. But I
also observed this sort of thing back in the days of Apache 2.0.x, and so your
numbers don't particularly surprise me. The Zend optimizer in PHP is pretty
smart, in my experience.
I'm sorry not to add any more depth of understanding beyond a simple, "No,
you're not crazy," but as I said the raw speed of an include was never an
issue for my largely database-constrained apps, so although I observed these
kind of results I never needed to dig deeper. Our test was run on a lark, not
due to actual need.
Scott
--
-----------------------------------------------------------------------------
Scott D. COURTNEY, Principal Engineer Sine Nomine Associates
scourtney@sinenomine.net http://www.sinenomine.net/
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org