Page 1 of 1

Speed of PHP (through a CDN)

Posted: Sat Mar 24, 2007 3:57 pm
by tad
I work for a CDN. I've been trying to get my boss to let me implement a CMS into the corporate website because things are constantly being updated and I'm the only one that can do it. His drawback of this is that using PHP might significantly slow the process of displaying the content of the site. Since we're a CDN our content should be faster than a normal site. I'd like to know what thoughts people have as far as speed when people are using PHP to generate dynamic content.

Here's how the CDN works (in case you're not familiar with the term): With the way we're using it for our site, we have all of our files in a server that we own that is our origin. Instantly, all of our larger file types are cached throughout our various servers all over the world (everything but HTML and PHP files - maybe some others.) So when someone grabs a page - say with a video on it and some images (all of which are cached the CDN) - in London it loads at the same speed as where my origin server is located here in the States - really fast.

The potential problem is if that video is called by a PHP script it may load "pretty fast" instead of "really fast" everywhere and we'll say that, in this case, its a significant difference because of the time it takes for the php to call that video from the network. Does anyone think that this may be the case? Please let me know what you think. Hopefully, I can talk my boss into it so that I won't have to keep resorting to using static HTML pages.

Posted: Sat Mar 24, 2007 4:13 pm
by nickvd
Can you explain what exactly a CDN (aside from a Canadian ;)) is and how it determines which server to load the content from.

It sounds like you are dealing with geographically targeted mirroring.

If implemented correctly, php shouldn't hurt things.

Posted: Sat Mar 24, 2007 4:45 pm
by tad
It's not necessarily geographical but whichever rout is the fastest with our CDN. However, yes, that plays a part. Say that I have a large library of music that I's like to get to my target audience which is a lot. If I use a regular hosting company based in Canada (eigh :wink: ) A single person in Tokyo may be able to see it but it would take longer than a single person in Canada. If my audience is large then that dude in Tokyo would have an even longer lag time because of everyone listening to my sweet jams at the same time. At this time I may be so popular that even my Canadian friends may know what that dude in Tokyo is talking "aboot."

If I used a CDN at this time this amazing music library would be cached on thousands of servers. So when Jo Tokyo jumps online the same time as Sally Canadian and all of her thousands of friends he's jammin' out just as if he's the only one on the server and it's right down the street (because this probably is the case.)

So now you know about a CDN (which may be based in Canada, but isn't the same.) As much as I just realized that I like talking about it, the only think it has to do with my question is my reason for using static HTML as opposed to a PHP CMS (I want it to appear significantly faster than the sites someone's use to.) Given that, would you say that a dynamic PHP site runs significantly slower than if I had my whole site in static HTML pages?

Posted: Sat Mar 24, 2007 4:49 pm
by John Cartwright
I fail to see how it is possible to cache large amounts of binaries over thousands of servers.. so I doubt I'll be of much help. But what is the deal with these static html pages -- are you caching the html or the binaries?

Just so you know, you can implement php caching systems easily. Also, the http protocol is not the best method for file transfer, have you considered other protocols?

One more thing.. it's eh not eigh :wink:

Posted: Sat Mar 24, 2007 5:05 pm
by tad
Actually, the HTML and PHP files don't get cached. Files such as images and videos and music are (and for some reason CSS.) A CDN is a service for larger companies that want to make their files seen faster and better (like when you go to ABC.com to watch the latest episode of "Lost.") We do also stream and and use other various delivery methods including HTTP. But that's beside the point.

I'm really just looking for a theory behind the how fast PHP renders HTML as opposed to a static HTML page. Caching is something that I can already do well. But thanks for being so responsive.

Posted: Sat Mar 24, 2007 5:16 pm
by John Cartwright
PHP is typically really fast unless you are serving the large files through the php intepreter (which would slow things down a bit, ie readfile()), although I take it your CDN handles that. If all your doing it serving dynamic html with php, I wouldn't worry "aboot" speed or memory, eh?.

Posted: Sat Mar 24, 2007 5:20 pm
by tad
Thanks a lot! That's all I was worried about. Maybe, with this input, I'll be able to drop my static pages and setup a nice CMS... pending my boss's approval.

Posted: Sat Mar 24, 2007 11:09 pm
by nickvd
One thing is still puzzling me. What the heck does CDN stand for?

Posted: Sat Mar 24, 2007 11:13 pm
by John Cartwright
nickvd wrote:One thing is still puzzling me. What the heck does CDN stand for?
http://acronyms.thefreedictionary.com/CDN

Consolidated Data Network I believe

Posted: Mon Mar 26, 2007 2:40 am
by Kieran Huggins
I nearly choked on my bacon when I read this, eh!

RRRRROLL UP THE RIM!

:rofl:

Posted: Mon Mar 26, 2007 10:10 am
by John Cartwright
Kieran Huggins wrote:I nearly choked on my bacon when I read this, eh!

RRRRROLL UP THE RIM!

:rofl:

... to win..

No point of rolling the rim if you don't want to win.. unless you are some weird rim roller.. :lol:

Posted: Mon Mar 26, 2007 10:14 am
by tad
Actually, I meant CDN as in "Content Delivery Network" http://en.wikipedia.org/wiki/Content_Delivery_Network

Posted: Mon Mar 26, 2007 3:51 pm
by Kieran Huggins
I never win :-(

For all the other confused people:
http://en.wikipedia.org/wiki/Tim_Horton ... Rim_to_Win

Tim Horton's is such a Canadian institution that we actually distribute new coinage through them instead of the bank... much more efficient that way.