简体   繁体   中英

Performance orientated message callback solution in c++

I am trying to develop a p2p distributed concurrent programming solution in C++. For higher throughput I have observed that "to and fro" concurrent and scalable network solution is required as in actor model provided by AKKA. Unfortunately there is no reliable solution for actor model available in C++. libcppa is available but only in Beta quality. Is there any scalable and concurrent solution do same in zeroMQ or Boost.asio etc? Programatically I want to do following very fast and in scalable fashion.

Suppose I have a cluster of N nodes which contain separate set of objects. When a node require a remote object it sends a request and get backs a object as a response. Currently I do it in following manner:

Request req = Network.request(Node x, objectId id);
req.waitforResponse( ); //Implemented through Conc-Hashmap of requests and wait & signal
Object obj = req.response().getObject();
// Do sth with object.

I don't want to implement last two lines of codes myself. I want it to be done by networking library itself. Best solution will be if I can get "req" object in some sort of "Future" data structure which will block only on calling getObject(). I think it is a very generic problem and there should be some good open source solution available for it. If not please suggest some more efficient solution other than Concurrent hashmap (C++ Intel threads) based approach. Unfortunately my good amount of googling on it did not pay much.

As no one answered it. I am just updating solution which I used. I used MsgConnect with my thread pool to handle the events and callbacks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM