开发者

RPC, sockets and performance considerations

I have two machines in the same subnet. I want to exchange objects between the two machines as quickly as possible. It is using g++ and it is on Debian/Ubuntu. The machines are loaded in traffic and CPU.

  • One way is to send a compressed serialisation of the object over sockets as binary packets (using Google protocol buffers for the encoding for ex).

  • CORBA seems an overkill for this

  • I read some articles about ONC-RPC and Sun RPC

  • does Boost have an efficient library for this ?

I am sure you have other ideas. How would you do it to garantee the best response t开发者_如何学Goime in 2011... I am OK to give up just a little tiny bit on response time to get a standard solution.


You could combine Google protobuf for serialization with Boost.ASIO to handle the actual I/O. That should offer a good balance between performance and implementation time.


The Zeromq people have experimented with using a Linux realtime kernel to guarantee low latency. As you can see, a big amount of average latency has to be sacrificed for this guarantee. Depending on the application it may be a necessary tradeoff.

http://www.zeromq.org/results:rt-tests-v031


When you say you want to "exchange objects between the two machines as quickly as possible" it sounds like what your'e interested in is limiting network bandwidth as much as possible. If that's the case, you might consider using the FAST protocol.

The acronym FAST officially means "FIX Adapted for Streaming" which implies that it is best suited to the FIX protocol, but this really isn't true. FAST can be used with really any protocol.

FAST-encoded packets can be extremely small, and a good implementation will use a limited amount of CPU resources in the encoding and decoding. The tradeoff is the FAST protocol isn't the easiest thing in the world to grok by a human, and the code can be quite tricky to get right. There are open source products implementations available which may or may not be appropriate for your needs. One such implementation for C++ is QuickFAST.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜