Hey Guys-
Well, I've done some searching and haven't found an answer to this. I am in the process of writing a PHP based CMS system (its actually a conversion of an older system I wrote in CF).
Anywho, so far I have been aiming for page execution times in the range of 0.050 Seconds or less. Obviously, for some complex functions, this will climb, but for primary pages that just have a design template wrapped around some customer entered HTML, this is my goal. In general, I am able to get most pages to load in less than 0.020, but I'm trying to figure out if I am being too restrictive on myself?
In addition, how well does PHP handle concurrency and is there a good way to test this? Mainly what I'm curious about is, if I have 10 visitors requesting the same page all at once (say the home page), does PHP create a seperate request for each one, or does it handle them one at a time? I know that Apache spawns a separate request for each, but just not sure about PHP itself.
Also, when handling include files, I tend to use require_once() so that the page fails if it can't find a file, but so that it doesn't include the file all the time. What kind of a time hit is incurred by including includes all up front? Specifically, I have about 5 libraries of functions that I include by default as about 70% of the pages require at least one function from each. The main ones are a Database Abstraction Layer for performing all DB queries and a Mail Abstraction layer. Now, obviously not every page requires the DB or even email, but what are the downsides to including multiple require_onces? Basically is it better to have one require_once at the beginning of an application, or is it better to have the call require_once called only when needed, but possibly getting called 10 - 12 times in a single page execution?
Thanks for any help you can give, and if you can point me to some threads or sites with this information, that's fine as well. My searches didn't turn up much, but I may not be searching the best way possible for this forum.
Execution Time - What is a Good Number?
Moderator: General Moderators
Hey hey hey, check out the second paragraph of the linked-to section in this wikipedia article.
Make your program work mate, and if it's running slow, use a profiler to find out where it's lagging and fix the problem parts.
Cheers!
- Nathaniel
Make your program work mate, and if it's running slow, use a profiler to find out where it's lagging and fix the problem parts.
Cheers!
- Nathaniel
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
0.02 for static pages is quite reasonable. Optimization should be the least of your concerns right now.if I am being too restrictive on myself?
It depends. When installed as FastCGI, yes, there will be a separate PHP process for every call. As an Apache module, no.In addition, how well does PHP handle concurrency and is there a good way to test this? Mainly what I'm curious about is, if I have 10 visitors requesting the same page all at once (say the home page), does PHP create a seperate request for each one, or does it handle them one at a time? I know that Apache spawns a separate request for each, but just not sure about PHP itself.
For large codebases, quite a bit, but this can be mitigated with bytecode caching.Also, when handling include files, I tend to use require_once() so that the page fails if it can't find a file, but so that it doesn't include the file all the time. What kind of a time hit is incurred by including includes all up front?
Specifically, I have about 5 libraries of functions that I include by default as about 70% of the pages require at least one function from each. The main ones are a Database Abstraction Layer for performing all DB queries and a Mail Abstraction layer. Now, obviously not every page requires the DB or even email, but what are the downsides to including multiple require_onces? Basically is it better to have one require_once at the beginning of an application, or is it better to have the call require_once called only when needed, but possibly getting called 10 - 12 times in a single page execution?
Once again, depends. Conditional includes are the bane of bytecode caches. But compiling PHP files takes a sizable chunk of execution time.
Search for profiling in PHP (Xdebug's good) and load generators.Thanks for any help you can give, and if you can point me to some threads or sites with this information, that's fine as well. My searches didn't turn up much, but I may not be searching the best way possible for this forum.
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
Ilia Alshanetsky,s PHP & Performance (PDF)
George Schlossnagle's Building Scalable PHP Applications (PDF)
George Schlossnagle's Building Scalable PHP Applications (PDF)