当前位置: 代码迷 >> PB >> One way to speed up Pb invoke
  详细解决方案

One way to speed up Pb invoke

热度:620   发布时间:2016-04-29 07:56:47.0
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....

?

?

  相关解决方案