Re: Node.PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



*bad link in last post

http://luvit.io/


-Joseph Moniz



On Tue, Apr 3, 2012 at 12:16 PM, Joseph Moniz <joseph.moniz@xxxxxxxxx> wrote:
> On Fri, Mar 30, 2012 at 5:56 PM, German Geek <geek.de@xxxxxxxxx> wrote:
>> Maybe stupid question, but is node.php really necessary? If you can program
>> PHP and it performs better than node.js, why would you need to have another
>> wrapper around things. Why not just program "normal" PHP?
>
> This is normal PHP in the same sense that node.js is normal
> javascript, python-tornado is normal python and ruby-event-machine is
> normal ruby. The only difference as stated by micheal was the async
> IO.
>
> On Fri, Mar 30, 2012 at 6:33 PM, Michael Save
> <savetheinternet@xxxxxxxxxxxx> wrote:
>> Also, I kind of doubt you can outperform node.js with standard PHP.
>
> On Sat, Mar 31, 2012 at 9:37 AM, Daniel Brown <danbrown@xxxxxxx> wrote:
>> On Fri, Mar 30, 2012 at 21:33, Michael Save
>> <savetheinternet@xxxxxxxxxxxx> wrote:
>>> Because "normal" PHP is not asynchronous.
>>>
>>> Also, I kind of doubt you can outperform node.js with standard PHP.
>>
>>    Your doubts are indeed well-grounded.  Using node.js (indeed,
>> V8-based apps in general) are compiled as native machine code, which
>> don't require the added overhead of a parser, such as PHP.
>
> This has been an on the side just for fun project for me mostly and as
> such i originally had the same performance assumptions as stated in
> this thread. Basically i was writing this "to get familar with php
> internals and to understand what goes into designing such a system".
>
> You can imagine my surprise when i ran bench marks against the example
> server against an equivelant node.js http server and the node.php
> implementation was able to respond to twice as many requests per
> second (14k req/s) then node.js could (7k req/s). Though i would take
> this with a grain of salt as the benchmark is largely unfair seeing
> how node.js is much more feature complete and hardend from production
> use. Never the less, i was absolutely shocked that this completely
> unoptomized and memory leaky node.php implementation i hacked together
> in one night was able to run circles around node.js in naive
> benchmarks.
>
> So i was absolutely confused to the performance boost with php so i
> started poking around asking people in various freenode channels if
> they had any hypothesis on why node.php was able to perform against
> node.js.
>
> I stumbled across a similar project to create a node.lua
> implemantation called luvit ( http://www.luvit.io ) and it also
> boasted the same exact performance boost vs node.js, thats is luvit
> was able to do 2x the requests as node.js in the same amount of time.
>
> From my exploration on nodes 1/2x performance vs node.php and luvit
> (node.lua) it turns out that V8 is fast only when it has to stay in JS
> mode. The problem with node like systems is the JS to native code
> boundary must be crossed several times to perform IO. So nodejs-core
> get's some of it's best performance boosts from reducing the amount of
> times JS has to call out to C++. The unfortunate detail is that
> node.js like systems get their "power" from doing lots of IO and every
> IO operation has to call out to C/C++ so node.js performance really
> drags around this gotcha in V8.
>
> I hold out some hope for native PHP performance tough. If some one
> were to invest the time into making a solid JIT based interpreter for
> PHP i'm fairly confident based on language characteristics and the
> performance characteristics associated with them that a PHP-JIT
> implementation would be able to leave V8 in the dust. Mostly due to
> explicit lexical scoping in PHP that would offset the Hidden-Class
> overhead of V8.
>
> In terms of PHP-JITs Facebook has already done some initial work on
> such a VM, they call it, not surprisingly, hip-hop-virtual-machine (
> http://www.facebook.com/note.php?note_id=10150415177928920 ) and it
> already doing almost no optimizations is closer to performance of
> compiled PHP via hiphop then it is to interpreted PHP via the de facto
> interpreter.
>
> - Joseph Moniz
>
>
>
>   With that
>> said, compiling PHP (such as with HopHop) would give at least
>> comparable performance results.
>>
>>    Still, all in all, I would never discourage someone doing a
>> 'node.php' application.  While its performance may not be quite as
>> good speed-wise, that doesn't mean it can't become more robust, more
>> generally-applicable, or even just find niche uses.  I've written
>> numerous socket servers in PHP for a variety of clients and uses,
>> where they made sense (speed of deployment, ease of code-management by
>> a number of developers who don't know C, et cetera).  I can easily see
>> where this could add value.
>>
>> --
>> </Daniel P. Brown>
>> Network Infrastructure Manager
>> http://www.php.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux