Web服务器:Mongrel2 简介
                 jopen
                 13年前
            
                    
  Mongrel2 是一个与应用程序、语言,网络架构无关的Web服务器。它具有以下特性: 
支持大量编程语言
当前支持17种编程语言。包括:
- C++: mongrel2-cpp
 - C: mongrel2chandler
 - Clojure: ring-mongrel2-adapter
 - Common Lisp: cl-mongrel2 and m2cl
 - Scheme: Mongrel2 for Chicken Scheme
 - Haskell: web-mongrel2
 - Java: MoJaHa and Mongrel2J
 - Lua: mongrel2-lua
 - .NET: m2net
 - PHP: m2php
 - Perl: Plack-Handler-Mongrel2 and AnyEvent-Mongrel2
 - Python: wsgid and Mongrel2-WSGI-Handler (old?)
 - Ruby: m2r and rack-mongrel2
 - Node.js: m2node.
 
还有Web开发框架:
- Tir is a Lua framework written to show how to do direct frameworks with Mongrel2.
 - Brubeck is an asynchronous, non-blocking web framework written in Python.
 - Bamboo is a Tir derivative with a bunch more features.
 - Photon is a PHP framework similar to Tir and way faster than PHP.
 
操作友好
您可以从任何支持的语言来控制Mongrel2几乎所有的方面。
多协议支持
支持 HTTP 1.1 and 1.0, Flash JSON Sockets, Flash XML Sockets, WebSockets (hybi).
现代设计
采用简洁,易于使用C语言开发,基于内部事件+协作的设计方式。
  
  基本架构是:
  
  a、非阻塞IO
  b、通过libtask实现event IO和每Connection一个coroutine
  c、和Mongrel一样用Ragel实现HTTP协议解析
  d、将Request编码为JSON或TNetString发送到ZeroMQ
  e、ZeroMQ的客户端作为Handler接收Request进行处理
  f、Handler将响应写回ZeroMQ
  g、Mongrel2将Response写回给Http Connection
  h、这整个过程又是通过Ragel管理状态机来实现的