简体   繁体   English

C ++中面向性能的消息回调解决方案

[英]Performance orientated message callback solution in c++

I am trying to develop a p2p distributed concurrent programming solution in C++. 我正在尝试在C ++中开发一个p2p分布式并发编程解决方案。 For higher throughput I have observed that "to and fro" concurrent and scalable network solution is required as in actor model provided by AKKA. 为了获得更高的吞吐量,我发现像AKKA提供的参与者模型一样,需要“往返”并发和可扩展的网络解决方案。 Unfortunately there is no reliable solution for actor model available in C++. 不幸的是,在C ++中没有针对actor模型的可靠解决方案。 libcppa is available but only in Beta quality. libcppa可用,但仅处于Beta质量。 Is there any scalable and concurrent solution do same in zeroMQ or Boost.asio etc? 在zeroMQ或Boost.asio等中是否有任何可伸缩的并发解决方案? 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. 假设我有N个节点的群集,其中包含单独的对象集。 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(). 最好的解决方案是,如果我可以某种“ Future”数据结构形式获取“ req”对象,则该结构仅在调用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. 如果不是,请提出一些比基于并发哈希图(C ++ Intel线程)的方法更有效的解决方案。 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. 我在线程池中使用了MsgConnect来处理事件和回调。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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