One way to speed up Pb invoke.

       Pb (stands for Perspective broker), a built-in rpc lib of twisted has been used widely.

Pb supports py built-in types directly like: int, list, dict ...

 

complex object need extra effort to be transferred on wire.

 

Pb serialization sucks...if arugments are complex...like following:

 

val = {"hello":"hello","foo":"bar","baz":100,u"these are bytes":(1,2,3)}

 

it takes very long time to process... in my machine (IBM T400)

 

only 1100 req/second...it is too slow...

 

how to speed up? a simple answer is : use another serialization method..

 

I use bson. you may freely choose cPicke, marshal or protobuf.

 

we send string directly and then deserialize manually.

 

Is it better??

 

it is three times faster... the machine can process 3300 req/second...

 

the second way is to use pypy....

 

 

你可能感兴趣的:(one)