Introduction and solution selection of comet Server

Source: Internet
Author: User
Tags apache tomcat
ArticleDirectory
    • The bottom line
Introduction and solution selection of comet Server

Introduction to comet Server:

A simple description is a push server with a persistent connection function that can push data to the client in real time.

Comparison of solutions:

After comparison between the five frameworks, the author finally chooses netty...

 

Address: http://amix.dk/blog/post/19456#Plurk-Comet-Handling-of-100-000-open-connections
 

Plurk comet: handling of 100.000 + open connections

Comet is a buzz word, just like Ajax, but a bit cooler. The bottom line in comet is that the server can push data to clients when new data arrives.

I think that comet is the next big thing and this trend can be seen in an upcoming product like Google wave that use Comet heavily for creating real time updates.

Plurk is growing fast and we are becoming one of the largest Python sites on the Internet. we serve several thousands of concurrent users PR. day (100.000 +), so implementing comet for plurk is a big challenge and I have spent around und a week on fiddling with different solutions.

Here are some of the technologies I have tired:

  • Python twisted: non-blocking server in Python. Unfortunately it ate a lot of CPU and cocould not scale
  • Jetty: they claim to have good support for Comet (and they do if you don't serve 100.000 clients at once ). the jetty installation we ran ate around 2 GB of RAM on 10.000 active users, which is unacceptable for our needs
  • Apache Tomcat: Same with jetty, it eats tons of memory, even thought they do support comet connections
  • Apache MINA: A NiO (non-blocking Io) framework which I used to build a HTTP server. Unfortunately Mina is very badly encrypted ented and it did not scale up in Production

After trying these out and found out that they cocould not handle a massive load I was about to give up. But then, I stumbled upon the Savior:

    • JBoss netty: A NiO framework, done by one of Apache Mina's founders

Netty is not that writable ented, but it's really well designed and after some hacking around the performance is pretty amazing.

The bottom line

Using netty we have comet running on 100.000 + open connections-This uses some GB of memory and 20% of CPU on a quad core server. i. e. we have solved the c10k * 10 problem using non-blocking technology and some pretty impressive libraries (namely Java NiO and netty ).

A Big kudos goes to trustin Lee for his amazing work on netty!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.