This is a discussion on Re: [PHP] slow performance within the PHP General forums, part of the PHP Programming Forums category; On Wed, April 25, 2007 5:48 am, Henning Eiben wrote: > But as far as I understand, java kinda ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
On Wed, April 25, 2007 5:48 am, Henning Eiben wrote:
> But as far as I understand, java kinda does the same thing, doesn't > it? Sort of, but not really... Java has a single central one giant process architecture. PHP has a shared-nothing architecture. They're at polar opposites on this bit. A PHP accelerator/cache wedges the Java-ness of caching the oft-used code in RAM, without the baggage of having everything in one giant process. > Java programs are being compiled into some intermediate language, and > this is being interpreted at runtime. So using an accelerator should > mimic the same setup for php. Yes, to a large degree. > Do you know any resource, describing how php works (like the thing > about > compiling opcode, and stuff)? How does php handle simultaneous > requests? Woof. There are TONS of resources out there, most of which are probably irrelevant to your actual problem, if you'd just profile the code and find out what's actually going on. > Are there multiple threads spawned? PHP is generally run in the context of Apache which runs multiple processes, not threads. Except in Apache 2, if you don't do pre-fork, which is dangerous if you're not 100% sure all the PHP extensions you choose to use are thread-safe. (Which nobody really really knows for sure.) And in Windows, maybe, where the whole concept of process/thread is of a different nature than Linux threads/processes. PHP itself does not spawn multiple threads nor processes, unless you install pcntl yourself and do that for your own application needs. PHP run under Apache lets Apache handle the process/thread splitting. Again, though, profile your code, please. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? |
|
|||
|
Richard Lynch wrote:
> On Wed, April 25, 2007 5:48 am, Henning Eiben wrote: >> But as far as I understand, java kinda does the same thing, doesn't >> it? > > Sort of, but not really... > > Java has a single central one giant process architecture. > > PHP has a shared-nothing architecture. > > They're at polar opposites on this bit. > > A PHP accelerator/cache wedges the Java-ness of caching the oft-used > code in RAM, without the baggage of having everything in one giant > process. OK, but when I run PHP as an ISAPI filter, I see in my process-explorer (systinternals) only one process (w3wp.exe), that has a lot of threads. This must be the concurrent request being served. Comparing this to Java, I also have only one process (java.exe) and a huge amount of threads. I would assume, that creating java-threads within a JVM is more lightweight than creating new threads at the OS-level like PHP needs to do. >> Do you know any resource, describing how php works (like the thing >> about >> compiling opcode, and stuff)? How does php handle simultaneous >> requests? > > Woof. > > There are TONS of resources out there, most of which are probably > irrelevant to your actual problem, if you'd just profile the code and > find out what's actually going on. Well, I want to describe my observations I made with PHP and Java, and I want to explain why PHP is so much slower, compared to Java. So I would like to add some references to my paper ... and to be honest, I'm afraid I would run out of time if I would profile PHP to figure exactly out what's going on. So I don't need the source-code of PHP to show what's *exactly* going on, but roughly describing how PHP works. >> Are there multiple threads spawned? > > And in Windows, maybe, where the whole concept of process/thread is of > a different nature than Linux threads/processes. hmm, too bad I'm stuck with windows :) > PHP run under Apache lets Apache handle the process/thread splitting. Well, same with windows ... I would assume that the IIS is handling the whole process/thread stuff > Again, though, profile your code, please. hmm ... as mentioned above - but I might give it a try -- .... The UART's won't take this speed, Captain |
![]() |
| Thread Tools | |
| Display Modes | |
|
|