1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP vs HTML Performance Battle?

Discussion in 'General PHP and MySQL Discussions' started by planetmaster, Jan 14, 2012.

  1. planetmaster

    planetmaster Member

    Hi,

    Its a question I've been bugging around since many weeks but haven't found a proper answer.

    So; I have a traffic monster site with few hundred pages that I occasionally change.
    My current language is PHP just to keep headers, sidebar, some boxes and footer in a separate file where I occasionally make minor changes. That's the only job of PHP on my site.

    The problem is my 16GB DDR3 RAM never drops below 95% usage!

    I have APC installed so my server doesn't needs to render PHP on every request.

    If I switch to HTML, will it give me noticeable advantage? (performance and memory consumption)
    Ofcourse editing the site would a pain but I can sacrifice that for performance.

    Also I'll be using a CDN soon. Does CDN pull HTML and PHP (or atleast PHP caches from APC)?

    I hope someone can throw in a proper reply rather than 'I think..' versions!

    Regards,
    Umer
     
  2. Shamil

    Shamil Well-Known Member

    On average, pure HTML is executed quicker than PHP. However, it won't be that much quicker if there's nothing really dynamic with regards to the content you're pulling in (i.e the template files).

    That said, you might experience a very slight increase in performance, but not much.

    A Content Delivery Network is just that, it hosts your static content (images, javascript etc.), and is irrespective of your HTML and PHP files (though, some CDNs are offering PHP and HTML processing capabilities).

    What are you using as your web server? Have you tried looking at using nginx or litespeed (with varnish/ litespeed caching)?
     
  3. planetmaster

    planetmaster Member

    Thanks for your reply!

    I've used LiteSpeed in the past and it sure is faster than Apache (A lot!) but since my entire site is in PHP, it will mainly run on on all CPU's regardless of how many CPU licenses I have.
    In that case, I would prefer Nginx because; I'll be honest here; it free, and in my case somehow fits better.
    I wouldn't mind paying for Litespeed but only if its worth it?

    Also, I'm planning a server upgrade soon so I haven't bothered replacing my Apache on my current server.

    I could really use your advice on NGINX vs Litespeed? (In constrast to my case)
     
  4. Shamil

    Shamil Well-Known Member

    I'm going to be as impartial as I can - as a note, I'm a LiteSpeed reseller.

    What I can't say is that one is better than the other - but what I can say is that nothing fits all solutions; so it'd be in your best interest to perform benchmarks etc on your setup and see which offers the most benefits per cost. Using pre-completed benchmarks, such as the ones available comparing vBulletin on several web servers with different caches might help. (https://www.vbulletin.com/forum/ent...caching-Apache-Varnish-versus-Litespeed-Cache) Just under a year old.

    Have you performed some benchmarks, because if you haven't. I suggest you do, and that way, we can guage what solution is best for you.
     
  5. moman

    moman Active Member

    Using PHP to include files should never be too much for a production environment to handle, although yes, it would be slower than serving straight-up HTML (we're talking milliseconds though). You could also try server-side includes if you want to bypass PHP (although in practice you'll probably get the same performance).

    Are you sure your server is configured correctly? If you have some bad redirects or rules set up for mod_rewrite, you can easily end up overloading your server when in fact it should be idling.

    How many pageviews per second does your site get?
     

Share This Page