Jboss的Netty项目旨在提供异步驱动的网络应用程序的框架和工具, 可以用于快速开发, 可方便维护的、高性能的、高扩展性的服务器/客户端之间的通迅协议。
<img onclick='window.open(this.src)' onclick="window.open(this.src)" src="http://www.jboss.org/netty/mainColumnParagraphs/0/p_w_picpath/architecture.png" alt="The" architecture="" diagram="" of="" netty"="" />
Plurk是一个快速成长,并且已经成为互联网上最大的几个使用python语言的网站之之一,Plurk尝试了以下一些框架/web容器:
Python Twisted:太耗资源了
Jetty:iGoogle的web容器,可惜一万并发的时候用了2G的内存
Apache Tomcat:太吃内存了
Apache MINA:文档很糟糕,可扩展性很差
最后,Plurk发现Netty非常优秀, 在一台四核的服务器上,10万的并发只用了some GB的内存和20%左右的CPU
转载: http://www.jboss.org/netty/performance/20090607-asalihefendic.html
Plurk Comet: Handling 100,000+ Concurrent Connections with Netty
URL: http://amix.dk/blog/viewEntry/19456
Posted by Amir Salihefendic on 07-Jun-2009
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 likeGoogle 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 many thousands of concurrent users pr. day (100.000+), so implementing comet for Plurk is a big challenge and I have spent around 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 could 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 2GB 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 documented and it did not scale up in production
After trying these out and found out that they could not handle a massive load I was about to give up. But then, I stumbled upon the savior:
Netty: A NIO framework, done by one of Apache MINA's founders
Netty is not that documented, but it's really well designed and after some hacking around the performance is pretty amazing.
<h2 style="font-size: 25px; font-weight: normal; display: block; font-family: " myriad="" pro',="" helvetica;="" color:="" rgb(66,="" 66,="" 66);="" margin-top:="" 5px;="" letter-spacing:="" -0.03em;="" margin-bottom:="" 0px;="" border-bottom-style:="" none;="" border-bottom-width:="" initial;="" border-bottom-color:="">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!