Re: Will PHP ever "grow up" and have threading?
| From: | Per Jessen | Date: | Thu, 25 Mar 2010 08:31:15 +0000 |
| Subject: | Re: Will PHP ever "grow up" and have threading? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-303425@lists.php.net to get a copy of this message | ||
Tommy Pham wrote:
> As such, let's dissect what you mentioned:
>
> 1) PHP with internal thread support
> 2) PHP with external C/C++ thread support
That's not quite what I mentioned, but I'll accept it for the sake of
argument.
> * Performance - having external thread support, now you have to call
> an extension (more memory usage and CPU cycles).
Tommy, you are already using millions of more cycles by running PHP
instead of C. It's a reasonable trade-off of course, but "using more
cycles" is not a valid counter-argument.
> If you happen to have a C/C++ guru who can then code that thread
> support into PHP extension, wouldn't it still perform better at the
> core vs as an extension because it's not talking to a 'middle man'?
It's another trade-off Tommy - you run two separate processes, talking
to each other over TCP (for instance) to gain 1) performance and 2)
flexibility/scalability. You gain performance by having processes that
can be independently scheduled by the OS, and you gain flexibility by
being able to move a process to another box (for scalability). You pay
for that with a few thousand cycles. When you decide to use a database
(e.g. mysql) you also make a trade-off - well-managed data, a
structured query-language and some overhead vs. doing it all in your
own code.
> * Portability - if you're currently running PHP on Windows, but manage
> to convince management to switch to *BSD/Linux, then you'd have to
> rewrite that external thread support.
If portability is a concern, I'd make sure my threaded backend would run
on all the platforms I could envision. Portability is merely one of
many factors that affect choice of programming language.
> * Managability - should your need to upgrade PHP for either bug fix,
> new features you'd want to implement to add more functionality to your
> site, will that then break your custom external solution? How much
> more manageable is it if it's done under 1 language versus 2+?
I said it yesterday already - having a single implementation language IS
a positive, but it may not always be possible due to requirements.
--
Per Jessen, Zürich (12.3°C)