-1

I've read and heard that nods.js should be better and lighter at the server when doing long-polling then on a PHP-server. I'm doing a study on this and would like to measure the serverload at two simple long-polling applications to see the difference.

How could I measure this in a good way? I read something about apache bench but don't know if that works when doing long-polling. Also, I'm running on localhost.

Here are my two applications if someone want to take a look: https://github.com/furst/longpolling

Inzajt
  • 135
  • 1
  • 13
  • 1
    Seeing that node.js is a server and PHP is a language, how can you determine if node.js more efficient if you're actually comparing it with the **server** that's in front of PHP? Where did you get this crazy idea in the first place? – N.B. Jun 04 '14 at 10:16
  • I'm sorry if I was unclear, I meant on a php-server with php code. I want to exclude libraries and such to make the two applications only rely on a simple codebase. I got the idea on this post http://stackoverflow.com/a/5062670/1422006 – Inzajt Jun 04 '14 at 10:38
  • If you level the playing field and use the event loop which node.js uses with your PHP server - you'll get pretty similar results when it comes being "nice" on the server. What do you want to achieve? – N.B. Jun 04 '14 at 14:44

1 Answers1

0

NodeJS is a whole platform built with various packages and relies on various installed libraries to make "concurrency", sockets and event driven programming possible. This makes it able to do a lot of very interesting stuff, and it can do it quickly.

PHP is just a programming language, just like JavaScript is, and therefore PHP and NodeJS are not directly comparable. PHP has projects with scopes and intentions as NodeJS, they are just a little less known.

Ratchet: WebSockets for PHP

That is built on top of the socket component from ReactPHP, which together aims to be a much more fair comparison to NodeJS.

Phil Sturgeon
  • 29,768
  • 12
  • 74
  • 117
  • Thanks, going with this solution instead. How can I test performance on the ratchet webserver? – Inzajt Jun 06 '14 at 08:27
  • You'd need to be considerably more specific. Performance is a lot of things. Are you looking for low response times, low memory consumption, or what? Either way, Apache Benchmark and Xhprof can probably help. – Phil Sturgeon Jun 07 '14 at 15:13