Speed diff between SSI and PHP?

E

e n | c k m a

Hello,

Just curious as to whether or not anyone here knows which is faster between
SSI and PHP? My business partner and I are thinking of using either of them
to include files (ie. menus, headers, footers) as part of templates. My mate
wants to use PHP and I'm leaning towards SSI. I've searched google groups
for an answer but found conflicting responses... perhaps it depends on the
application?

I thought perhaps SSI would be faster because it's a local Apache module and
PHP is a third party interpreter... any comments?

Thanks in advance,

Nick.
 
L

Leif K-Brooks

e said:
Just curious as to whether or not anyone here knows which is faster between
SSI and PHP?

Just tested a simple file with one include in PHP and SSI over 10,000
requests with ApacheBench. The mean average for time per request was
1.207 milloseconds for PHP, and 0.861 for SSI. Of course, if your
application needs to do things SSI can't, you'll want to use something
more complex like PHP.
 
R

rf

Leif K-Brooks said:
Just tested a simple file with one include in PHP and SSI over 10,000
requests with ApacheBench. The mean average for time per request was
1.207 milloseconds for PHP, and 0.861 for SSI. Of course, if your
application needs to do things SSI can't, you'll want to use something
more complex like PHP.

So, SSI is .35 milliseconds faster. Compare this to the tens or even
hundreds of milliseconds it takes to get the results back to the client. I
think the difference is irrelevant :)
 
L

Leif K-Brooks

rf said:
So, SSI is .35 milliseconds faster. Compare this to the tens or even
hundreds of milliseconds it takes to get the results back to the client. I
think the difference is irrelevant :)

Yeah, but some of can't sleep at night because our application is .01
milliseconds too slow. :)
 
S

Shailesh Humbad

rf said:
So, SSI is .35 milliseconds faster. Compare this to the tens or even
hundreds of milliseconds it takes to get the results back to the client. I
think the difference is irrelevant :)

10,000 times .35 is 3500 seconds of server CPU time. That can be
important in some circumstances. My opinion is also that SSI will be
faster than PHP at a raw level. However, the above test is
inconclusive because does not explain whether or not server-side
includes processing was turned off when testing PHP, and if PHP was
turned off when testing SSI. That could make a difference. Also,
there are engines, particularly Zend, which cache PHP output files.
So the particular configuration of your server will highly affect your
results. In any case, switching your include statements between SSI
and PHP is a simple find/replace if you do it right. So just pick
one, and once you build your site, you can evaluate which is faster.
I think processing time for include files is not going to be your
biggest concern.
 
R

rf

Shailesh said:
rf wrote:

10,000 times .35 is 3500 seconds of server CPU time.

Last time I looked 10,000 times .35 *milliseconds* is 3.5 seconds :)

Insignificant, given that even with a 100MHz nic, and assuming 47000(*)
bytes per hit (including images), it would take 47 seconds just to ship the
data out, ignoring all other network considerations.

(*) plug in your average page size here.

There are threads happenning at the moment that suggest that doing any PHP
(or SSI) will defeat browser/proxy caching, unless carefull attention is
taken with the headers. Eliminating server side processing for just 10% of
your pages (thus enabling caching) would have a far more dramatic effect on
the server than 3.5 seconds of CPU time.
 
R

rf

rf wrote
client.

Last time I looked 10,000 times .35 *milliseconds* is 3.5 seconds :)

Insignificant, given that even with a 100MHz nic, and assuming 47000(*)
bytes per hit (including images), it would take 47 seconds just to ship the
data out, ignoring all other network considerations.

(*) plug in your average page size here.

Damn, forgot to add this bit:

Consider a chain. You should be worrying real hard about the weakest link in
that chain. You should ignore the bits that have little or no impact on the
performance of the chain.

I once found one of my progammers had spent half a day optimizing a piece of
code. Did well, got it down from one second to half a second CPU time. The
trouble was this peice of code executed once in the initialization section
of a program that ran for over 5 hours. An overall saving of .0027%. We had
a conversation about this :)
 
A

Art Sackett

rf said:
There are threads happenning at the moment that suggest that doing any PHP
(or SSI) will defeat browser/proxy caching, unless carefull attention is
taken with the headers.

To ensure that you don't break caching, use XBitHack and a little RTFM
about setting permissions. Works just fine.
 
W

Weyoun the Dancing Borg

e said:
Hello,

Just curious as to whether or not anyone here knows which is faster between
SSI and PHP? My business partner and I are thinking of using either of them
to include files (ie. menus, headers, footers) as part of templates. My mate
wants to use PHP and I'm leaning towards SSI. I've searched google groups
for an answer but found conflicting responses... perhaps it depends on the
application?

I thought perhaps SSI would be faster because it's a local Apache module and
PHP is a third party interpreter... any comments?


SSI is part of PHP
 
W

Weyoun the Dancing Borg

rf said:
Weyoun the Dancing Borg




Er, what?

What leads you to this conclusion? SSI was around way before PHP was
written.


yes but you can use includes as part of PHP. I dont see them as mutually
exclusive. ASP has them too. they arent exactly the same thing but they
do the same thing.
 
R

rf

Weyoun the Dancing Borg
yes but you can use includes as part of PHP.

Yes. PHP includes. Nothing to do with SSI.
I dont see them as mutually
exclusive.

What? Of course they aren't. How could they be. SSI knows nothing about PHP
and vice versa.
ASP has them too. they arent exactly the same thing but they
do the same thing.

Yes. APS includes I suppose. Nothing to do with SSI though.

Perl has includes too. Just about every server side facility has includes.
That is no reason to incorrectly state: "SSI is part of PHP". Newbies might
get confused :)
 
T

Toby Inkster

Weyoun said:
yes but you can use includes as part of PHP.

PHP does include (no pun intended) an include() function, but that
include() function is not SSI -- it uses an entirely different syntax and
is processed in an entirely different way.
I dont see them as mutually exclusive.

It is possible to set up your server so that files can be parsed for both
PHP and SSI, but it is tricky and has no real advantages.
ASP has them too.

ASP's includes look like SSI and smell like SSI but they sure don't taste
like SSI. ;-)
 
S

Spacen Jasset

e n | c k m a said:
Hello,

Just curious as to whether or not anyone here knows which is faster between
SSI and PHP? My business partner and I are thinking of using either of them
to include files (ie. menus, headers, footers) as part of templates. My mate
wants to use PHP and I'm leaning towards SSI. I've searched google groups
for an answer but found conflicting responses... perhaps it depends on the
application?

I thought perhaps SSI would be faster because it's a local Apache module and
PHP is a third party interpreter... any comments?

Thanks in advance,

Nick.
SSI is going to be slightly faster per impression and you may want to use
this, but you can use PHP aswell SSI anyway. PHP has to be interpreted so
uses more server resources. Whereas a webserver only needs to look for SSI
tags and include them. Most web servers also cache SSI included files for
faster delivery. (depending on content)
 
W

Weyoun the Dancing Borg

Weyoun said:
yes but you can use includes as part of PHP. I dont see them as mutually
exclusive. ASP has them too. they arent exactly the same thing but they
do the same thing.


It seems I have been confused by the terminology - my bad!

Learn something new every day. I was under the impression that the PHP
and ASP includes were done "server side" (I think they are!!) and thus
logically are Server Side Includes. It appears I was wrong. Appologies
to the OP for any confusion. I'm not a pro by any means - I can code in
ASP and PHP pretty well, but have never done a course or hold any bits
of paper saying I can. I just taught myself. Looks like I need to do
some more learning !


thanks for th einfo guys!
 
L

Leif K-Brooks

Weyoun said:
Learn something new every day. I was under the impression that the PHP
and ASP includes were done "server side"

They are.
and thus logically are Server Side Includes.

Correct, but since Server-Side Include is also the name of a specific
Apache technology, it's confusing to refer to anything else by that
name. Like if there was a company that made cars called "A Car Company",
you wouldn't call Ford a car company even though it is.
 
S

Sid Ismail

: Hello,
:
: Just curious as to whether or not anyone here knows which is faster between
: SSI and PHP? My business partner and I are thinking of using either of them
: to include files (ie. menus, headers, footers) as part of templates. My mate
: wants to use PHP and I'm leaning towards SSI. I've searched google groups
: for an answer but found conflicting responses... perhaps it depends on the
: application?
:
: I thought perhaps SSI would be faster because it's a local Apache module and
: PHP is a third party interpreter... any comments?


Which car is faster - a Chev or VW? Why, it depends on the other traffic
on the road, of course!! Does it really matter?

Sid
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top