Jonah H. Harris | 1 Apr 2010 19:59
Picon
Gravatar

Re: [PHP-DEV] php and multithreading (additional arguments)

On Thu, Apr 1, 2010 at 12:57 PM, speedy <speedy.spam <at> gmail.com> wrote:

> Now imagine a whole web server written in PHP (ie. nanoserv), say, using
> libevent as the network backend, running the above described real-time web
> implementation. Alternatively, you could perhaps even wire it into
> worker/event
> model of apache/other servers instead of rolling your own. It sounds quite
> powerful,
> and development-effort-wise cheap - out of a mere HTML preprocessor!
>
> With proper threading, this would be a piece of cake to implement in PHP,
> efficiently
> and ensuring low latency, using up all available CPU cores / resources.
>
> Without using native threads, the whole class of web architectures on both
> server
> and processing levels, viewed both separately or together, are quite a bit
> more hairy
> to implement.
>

Sorry, but as a performance-oriented C developer who has written a good
amount of stuff directly against libevent, I'm having a hard time not
laughing at this thread.  Why would anyone want to write such a thing
directly in PHP, or any other scripting language for that matter?  If you're
worried about performance, you're going to have to do it in something either
low-level or that is natively compiled.  In the scripting language world, I
can only think of something like Lua with libevent bindings as being capable
of performing fairly well in a multi-threaded environment (given no GIL).
Though, even in that case, you'd still have a good amount of custom work to
(Continue reading)


Gmane