Speed diff between SSI and PHP?

Discussion in 'HTML' started by e n | c k m a, Jul 31, 2004.

  1. 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.
    e n | c k m a, Jul 31, 2004
    #1
    1. Advertising

  2. e n | c k m a wrote:
    > 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.
    Leif K-Brooks, Jul 31, 2004
    #2
    1. Advertising

  3. e n | c k m a

    rf Guest

    "Leif K-Brooks" <> wrote in message
    news:...
    > e n | c k m a wrote:
    > > 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.


    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 :)

    --
    Cheers
    Richard.
    rf, Jul 31, 2004
    #3
  4. rf wrote:
    > 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. :)
    Leif K-Brooks, Jul 31, 2004
    #4
  5. rf wrote:

    > "Leif K-Brooks" <> wrote in message
    > news:...
    >
    >>e n | c k m a wrote:
    >>
    >>>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.

    >
    >
    > 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.
    Shailesh Humbad, Jul 31, 2004
    #5
  6. e n | c k m a

    rf Guest

    Shailesh Humbad wrote:
    > rf wrote:


    > > 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.


    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.

    --
    Cheers
    Richard.
    rf, Jul 31, 2004
    #6
  7. e n | c k m a

    rf Guest

    rf wrote
    > Shailesh Humbad wrote:
    > > rf wrote:

    >
    > > > 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.

    >
    > 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 :)

    --
    Cheers
    Richard.
    rf, Jul 31, 2004
    #7
  8. e n | c k m a

    Art Sackett Guest

    rf <rf@.invalid> wrote:

    > 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.

    --
    Art Sackett,
    Patron Saint of Drunken Fornication
    Art Sackett, Jul 31, 2004
    #8
  9. e n | c k m a wrote:
    > 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
    Weyoun the Dancing Borg, Jul 31, 2004
    #9
  10. e n | c k m a

    rf Guest

    Weyoun the Dancing Borg

    > SSI is part of PHP


    Er, what?

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

    --
    Cheers
    Richard.
    rf, Jul 31, 2004
    #10
  11. rf wrote:

    > Weyoun the Dancing Borg
    >
    >
    >>SSI is part of PHP

    >
    >
    > 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.
    Weyoun the Dancing Borg, Jul 31, 2004
    #11
  12. e n | c k m a

    rf Guest

    Weyoun the Dancing Borg
    > rf wrote:
    > > Weyoun the Dancing Borg
    > >
    > >>SSI is part of PHP

    > >
    > > 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.


    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 :)

    --
    Cheers
    Richard.
    rf, Jul 31, 2004
    #12
  13. e n | c k m a

    Toby Inkster Guest

    Weyoun the Dancing Borg wrote:
    > rf wrote:
    >> Weyoun the Dancing Borg
    >>
    >>> SSI is part of PHP

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

    >
    > 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. ;-)

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Now Playing ~ ./dexter_freebish/tripped_into_divine/09_breathe.ogg
    Toby Inkster, Jul 31, 2004
    #13
  14. "e n | c k m a" <> wrote in message
    news:riCOc.24294$...
    > 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)
    Spacen Jasset, Jul 31, 2004
    #14
  15. Weyoun the Dancing Borg wrote:
    > rf wrote:
    >
    >> Weyoun the Dancing Borg
    >>
    >>
    >>> SSI is part of PHP

    >>
    >>
    >>
    >> 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.



    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!
    Weyoun the Dancing Borg, Jul 31, 2004
    #15
  16. Weyoun the Dancing Borg wrote:
    > 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.
    Leif K-Brooks, Jul 31, 2004
    #16
  17. e n | c k m a

    Sid Ismail Guest

    On Sat, 31 Jul 2004 01:08:39 GMT, "e n | c k m a" <> wrote:

    : 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
    Sid Ismail, Jul 31, 2004
    #17
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cyril Vi?ville

    diff Process under diff users

    Cyril Vi?ville, Jun 29, 2004, in forum: Perl
    Replies:
    1
    Views:
    497
    Joe Smith
    Jun 29, 2004
  2. Hats
    Replies:
    3
    Views:
    443
    Spartanicus
    Jun 20, 2005
  3. Santa
    Replies:
    1
    Views:
    1,059
    Mark A. Odell
    Jul 17, 2003
  4. Rajive Narain
    Replies:
    0
    Views:
    1,532
    Rajive Narain
    Sep 18, 2009
  5. The Poor
    Replies:
    2
    Views:
    219
    Gregory Toomey
    Sep 27, 2003
Loading...

Share This Page