Click here to Skip to main content
15,881,803 members
Articles / Programming Languages / Python
Tip/Trick

Google Web Engine API Channel vs. Node.js+Socket.io (comparing performance)

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
2 Apr 2013CPOL2 min read 16.2K   3  
Comparing performance channel api and socket.io on example of multiuser whiteboard

Introduction 

My purpose is to implement a mutliuser shared whiteboard for my university project. Such a type of application needs to communicate extensively with the server, so AJAX is not fast enough.  

The possibilities which I have found on the web were:

This small article is going to be about comparing the performance of  Channel API and Node.js+socket.io 

Using the code 

I am not going to explain how the code is working, as it's pretty much explained in the Resources which I have used (see below).

If you would like to run the Google app engine implementation you would have to use the Google app engine (see their documentation here: https://developers.google.com/appengine/docs/python/gettingstartedpython27/)

If you would like to run the node.js+socket.io implementation, you would need to use some hosting for it. I used free amazon's hosting for that (here is the explanation on how to configure your amazon instance for using node.js http://iconof.com/blog/how-to-install-setup-node-js-on-amazon-aws-ec2-complete-guide/

The source code is attached to the article in zip archives. 

Conclusion

So, the code which I wrote for the Python+Channel API (hosted on google app engine) is almost the same as the one which I wrote for Node.js+socket.io (hosten on Amazon micro instance), but performance of socket.io is better than performance Channel API. I suppose the reasons for that are the following:

  • Channel API supports only server->client communication. To send messages from client to server I had to use usual http requests through ajax. Meanwhile, socket.io supports two-way communication. 
  • Channel API doesn't  support broadcasting of messages (sending them to all clients). So I had to track current connected clients and send them the messages. 
One more thing which I have noticed:

It seems that if you send many messages through Channel API they don't always arrive in the order in which they hsd been generated. I am not sure about that, but the code, which I wrote using Channel API behaves a little bit buggy: instead of ending a line and starting a new line, it can connect the end of the first line with the beginning of the second line (this can happen especially if you draw quickly). Although, I don't have that problem with that same code while using socket.io. 

Here is the link to demostration of the application's performance: http://youtu.be/sI1hb-ybb5w 

As you will see, my the application is pretty slow and there is a lot to be done, but it's enough for comparison of Channel API and socket.io. 

Resources used  

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Czech Republic Czech Republic
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --