Take the 2-minute tour ×

As a social game developer I am responsible for architecting two - or more - highly scalable web services. Where I am stumped is making the right choice of language and framework for implementation. By the nature of social games, the services are public facing and must be able to scale to millions of users. This is a purely software question about REST web services and the languages to implement them.

The two services that I know about right now have a few requirements that I shall summarise in case it influences an answer.

Game Data Service - Communication between client / server must be secure - Must be able to interface with Membase (ie. Memcached protocol) - Optional but advantageous AMF support - Also OAuth support could be advantageous

Stats Reporting Service - REST - MongoDB interface required

Here's the languages I have researched so far, Java / JAX-WS, PHP / Zend Framework, Python. I have written service stubs in all 3 languages, but I am now finding it difficult to choose which one to commit to. Common requirements of the services is that they must scale very well, so performance, stability and security is paramount.

Java seems to be the biggest player in the web service problem domain, however I am worried about committing to it because of the involvement with BlazeDS and Tomcat. I haven't worked with BlazeDS or Tomcat before, whether either is unsuitable for a production environment I don't yet know but am researching right after I make this post. Otherwise Java feels like a good fit to this problem domain, if not a little tricky to work with. I'm not afraid of complexity, but I am mindful of choosing the correct tool for the job.

PHP seems like less of a good fit. It is more difficult to architect a graceful web service with clean URLs and clean implementation logic. I also have concerns over the performance of Zend Framework, and security. Though it can be quick to cobble something together, I am unsure if it will scale gracefully. While I know it is certainly possible to produce the required result in PHP, again I am being mindful of which tool is the best for the job.

Finally we come to Python. I quite like the idea of writing the services in Python, however again I am unsure. I have only just begun to research into this language, and it looks as if it technically supports everything I need, though I don't yet know much about writing a REST service in Python. If any Python experts care to share their experience I would appreciate it. If Python is a good fit for the problem then I would lean towards using it, partly because I quite like the language, but that says nothing about stability or scalability.

If any web service experts out there are willing to throw ideas into the mix then I am open to suggestions. I just want to make sure that whichever language I commit to is the best possible fit for the purpose.

share|improve this question
This is subjective and argumentative. I as a PHP developer would obviously opt for PHP (and clean URLs in PHP are absolutely no problem...) A Python developer will tell you that both Java and PHP are shit and you should use Python! The Java developer will recommend Java. –  NikiC May 8 '11 at 9:28
And PS: I am pretty sure that "Java seems to be the biggest player in the web service problem domain" is wrong. Java is really rarely used on the web. The big player here is PHP. (Though I'm not saying it's the best choice. Other scripting languages like Python and Ruby are probably a good choice too. Basically: Choose what you know best. That'll probably give you the best results.) –  NikiC May 8 '11 at 9:30
There are some good information in this question: stackoverflow.com/questions/713847/… –  ralphtheninja May 8 '11 at 9:40
Each of the languages you've mentioned has the advantage of being recommended by it's proponents... However, I'd argue with your statement about Java being the biggest player. +1 for Magnus's comment. –  MattH May 8 '11 at 10:02
@nikic, "Java is really rarely used on the web"? Really? –  Thorbjørn Ravn Andersen May 8 '11 at 20:33
show 3 more comments

closed as not constructive by NikiC, ralphtheninja, Eli Bendersky, WhiteFang34, McDowell May 8 '11 at 10:06


1 Answer

Use python. Use twisted and all other problems become a thing of the past.


http://twistedmatrix.com Twisted is a powerful network engine that prides itself on being simplistic and clever without boilerplate code and complicated ideas. If a user can understand the basic idea that everything is an event waiting to happen then the possibilities are basically... Endless.

Reasons to use twisted for a REST web service.

  1. Twisted comes with a built in web library, this library offers access to http server and client, this server also allows a user to edit and control the way that a POST/GET or other value is handled.

  2. Simplicity, the actual code behind creating the server is basic. There are POST and GET methods for each of the resources on the server and then of course a way of storing them but written well can be roughly 100~ lines of clean code that almost reads like english. Here is an example of a REST service using twisted that stores and retrieves messages http://zenmachine.wordpress.com/web-services-and-twisted/

Reasons not to use twisted for a REST web service.

  1. Sometimes its hard to get your head around how it actually works (I know Im still struggling with bits of it) As many people who know and use it say the learning curve for the concept (not the framework) is worth the struggle but this can put alot of users off using twisted.

  2. Size of the dependacy, twisted is a huge dependacy and requires zope.interfaces, pyopenssl and a few other lib's to really be used to its full extent, although you can strip the final size of twisted down, the idea of adding another big dependacy to a project can annoy some programmers.

Success stories. (Taken from http://twistedmatrix.com/trac/wiki/SuccessStories)


We use Twisted to power our backend services, specifically our new accounts system and sync functionality we introduced recently ( http://tweetdeck.com/beta/features/take-tweetdeck-with-you/). We've deployed our Twisted services over the Amazon cloud - specifically, we use EC2 and SimpleDB. Writing a REST api service used by hundreds of thousands active users was a snap with Twisted. We'll continue to use Twisted as we broaden our server-side processing goals.

-- Reza Lotun, Software Engineer, TweetDeck, Inc.

share|improve this answer
"Use XSuperDuperFramework" is not of any help to anyone. If you include some of the pros (and cons) that X has to offer, an explanation of why it fits with the question (REST services), a link to X site, etc, then you'll get more positive than negative feedback. –  ypercube May 8 '11 at 9:49
Can you review your down vote now? –  Jakob Bowyer May 8 '11 at 10:13
I had not downvoted. (you have -2, +1 votes now) –  ypercube May 8 '11 at 10:15
^^ Sorry for thinking you had, still thanks for your advice. I will post more of a post next time I answer. :) –  Jakob Bowyer May 8 '11 at 10:17
Thank you for your contribution, I will most certainly look carefully at the framework you suggested. –  Christopher Gilbert May 8 '11 at 11:20
add comment
