现在的位置: 首页 > 综合 > 正文

Concurrence-concurrent网络应用必备

2013年09月09日 ⁄ 综合 ⁄ 共 1768字 ⁄ 字号 评论关闭

在寻找一个异步框架的时候,找到这个框架,Concurrence(http://opensource.hyves.org/concurrence/index.html)

 

 

Hello world:

 

 

 

Concurrence框架的目标是,提供一个更可用的编程框架,用以开发高性能的网络应用。

The goal of Concurrence is to provide an easier programming model for writing high performance network applications than existing solutions (Multi-threading, Twisted, asyncore etc).

特性:
  • Lightweight Tasks as the basic unit of execution.
  • Message passing as the basic unit of communication (between tasks).
  • Cooperative scheduling of tasks triggered by IO events and Timeouts.
  • Libevent based, always uses the most optimal asynchronous IO multiplexer for the given platform (epoll on linux, KQueue on BSD/OSX).
  • Fast low-level IO buffers implemented in Pyrex.
  • Socket API.
  • DBAPI 2.0 compatible MySQL driver implementation (native & asynchronous, with optimized protocol support written in Pyrex).
  • HTTP / WSGI Server.
  • HTTP Client.
  • Timeouts. All blocking API’s provide a timeout parameter.
  • Remoting. Message passing between tasks in diffent processes.

只是MySQL driver这个,就足够吸引我了。该死的python下只有一个driver。

 

安装也比较简单。(http://opensource.hyves.org/concurrence/index.html#download-installation)

 

 

有多高性能呢:

Benchmark of greeter.py (running with stackless python).

In this session it handled about 8300 request per second on 1000 concurrent connections:


    httperf --uri=/test --port=8080 --num-calls=1 --num-conns=100000 --rate=10000

    httperf --client=0/1 --server=localhost --port=8080 --uri=/test --rate=10000

        --send-buffer=4096 --recv-buffer=16384 --num-conns=100000 --num-calls=1


    Total: connections 98506 requests 98506 replies 98506 test-duration 11.815 s


    Connection rate: >> 8337.1 << conn/s (0.1 ms/conn, <=1022 concurrent connections)

    ...

    Request rate: >> 8337.1 req/s << (0.1 ms/req)

    Request size [B]: 64.0


    Reply rate [replies/s]: min 9707.9 avg 9850.2 max 9992.5 stddev 201.3 (2 samples)

    Reply time [ms]: response 8.0 transfer 0.0

    ...

 

 

 

抱歉!评论已关闭.