首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

One way to speed up Pb invoke

2012-12-19 
One way to speed up Pb invoke.?????? Pb (stands for Perspective broker), a built-in rpc lib of twis

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....

?

?

热点排行