File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737
3838## Dependent modules
3939
40- * msgpack-python (0.1.12)
41- * tornado (2.1.1)
40+ * msgpack-python (>= 0.1.12)
41+ * tornado (>= 2.1.1)
4242
4343## Performance
4444
45- OS: Mac OS X ver 10.6.8 <br />
46- CPU: Intel Core 2 Duo 2.13GHz <br />
47- Memory: 4GB 1067MHz DDR3
45+ OS: Mac OS X ver 10.8.2 <br />
46+ CPU: Intel Core i7 2GHz <br />
47+ Memory: 8GB 1600MHz DDR3
4848
4949<table >
5050 <tr >
51- <th></th><th>Request(call/s )</th><th>Notify(call/s )</th>
51+ <th></th><th>Request(QPS )</th><th>Notify(QPS )</th>
5252 </tr >
5353 <tr >
54- <td>2.7.1 </td><td>3076 </td><td>14182 </td>
54+ <td>2.7.2 </td><td>4782 </td><td>18315 </td>
5555 </tr >
5656 <tr >
57- <td>3.2.2 </td><td>2957 </td><td>13472 </td>
57+ <td>3.2.3 </td><td>4700 </td><td>16667 </td>
5858 </tr >
5959</table >
6060
61+ Test code are available in example directory(bench_client.py and bench_server.py).
62+
6163## TODO
6264
6365* Add advanced and async return to Server.
Original file line number Diff line number Diff line change 1+ import msgpackrpc
2+ import time ;
3+
4+ Num = 10000
5+
6+ def run_call ():
7+ client = msgpackrpc .Client (msgpackrpc .Address ("localhost" , 18800 ))
8+ before = time .time ()
9+ for x in range (Num ):
10+ client .call ('sum' , 1 , 2 )
11+ after = time .time ()
12+ diff = after - before
13+
14+ print ("call: {0} qps" .format (Num / diff ))
15+
16+ def run_call_async ():
17+ client = msgpackrpc .Client (msgpackrpc .Address ("localhost" , 18800 ))
18+ before = time .time ()
19+ for x in range (Num ):
20+ # TODO: replace with more heavy sample
21+ future = client .call_async ('sum' , 1 , 2 )
22+ future .get ()
23+ after = time .time ()
24+ diff = after - before
25+
26+ print ("async: {0} qps" .format (Num / diff ))
27+
28+ def run_notify ():
29+ client = msgpackrpc .Client (msgpackrpc .Address ("localhost" , 18800 ))
30+ before = time .time ()
31+ for x in range (Num ):
32+ client .notify ('sum' , 1 , 2 )
33+ after = time .time ()
34+ diff = after - before
35+
36+ print ("notify: {0} qps" .format (Num / diff ))
37+
38+ run_call ()
39+ run_call_async ()
40+ run_notify ()
Original file line number Diff line number Diff line change 1+ import msgpackrpc
2+
3+ class SumServer (object ):
4+ def sum (self , x , y ):
5+ return x + y
6+
7+ server = msgpackrpc .Server (SumServer ())
8+ server .listen (msgpackrpc .Address ("localhost" , 18800 ))
9+ server .start ()
You can’t perform that action at this time.
0 commit comments