views:

162

answers:

2

Hi,

I have a currently running PHP application that I want to add real-time feed (Google search latest result feeds), I have an implementation in PHP that does the following:

  1. An AJAX request to the server.
  2. The PHP responds.
  3. After 15000ms (15 seconds) using setTimeout(), we repeat the steps.

I knew this have very much overhead on the server and will cause the C10K problems.

After researching I figured out that PHP as an Apache2 module is incompetent to implement the Comet solutions which is unfortunate!

I have two options, to use Scala, or Use Python to implement this part of my website since it's all complete and there is no time for rewriting it.

I don't care for anything as I care for performance since I use VPS200 from ServerGrove, And I'm going to install JVM or Python side-by-side with PHP.

So what you think has less memory/CPU consumption in this case JVM with Scala, Or Python?

Thanks in advance

Update: I guess I'll use Akka Project, I'm going to test it.

+2  A: 

Scala with lift (lliftweb.org) will have better opportunity for performance. Comet support in Lift is excellent. You should test them both though with a small prototype and compare.

Unoti
+5  A: 

Why not node.js? It has a proven reputation of the solution that perfectly handles COMET. Everyone knows Plurk success story - one of the most popular social networking sites in Asia that has 500+mln subscribers, with up to 200k of them working in a parallel (using COMET long-polling connections). node.js memory usage is way better (~10 times less) compared to solutions based on java app server suitable for COMET (Jetty/Netty).

If you finally want to go with Java/Scala, you should first of all have a look at Atmosphere framework. It has the richest feature-set these days (supports all kinds of COMET strategies + web-sockets + servlets 3.0); out-of-the-box REST-support, based on Jersey (implementation of JAX-RS specification); integration with Akka (very powerful implementation of actors, fault-tolerance, STM, remotings etc on Scala).

Choosing a Lift, you'd probably have to re-write your application entirely, though it has a very good COMET support.

Vasil Remeniuk
I can't in any case take the chance of rewriting, at least not this time! it's purely MVC and I suspect I'd be able to just convert it!
Omar Dolaimy