JGroups equivalent library in C++ - c++

at work we have been using JGroups and I have to say that I really like it, however, at home I primarily build with C/C++.
I'm wondering if anyone knows of any good/solid ports of JGroups to C++ or any other equivalent software library for C++. I'm interested in hearing pros/cons of various libraries out there.
Though this isn't a requirement, I am most familiar with SDL's SDL_net so a nice wrapper class around SDL_net would be the most favorable to me.

I don't know of any ports of JGroups to C++. Some folks run JGroups as a daemon and then talk to it from other languages via a protocol. I recently created a STOMP protocol, which allows for messages sent by clients written in different languages to be processed by JGroups, and for those clients to receive messages as well.
Re: native stacks, you could take a look at Spread (www.spread.org).

You might want to check out 0mq. Its pretty fast and easy to use.

Related

How to write c++ spout/bolt on Storm and Thrift usage in Storm

From here:
Storm was designed from the very beginning to be compatible with multiple languages. Nimbus is a Thrift service and topologies are defined as Thrift structures. The usage of Thrift allows Storm to be used from any language.
I see that a topology created in java get deployed by serializing the topology (spouts, bolts , ComponentCommon) as a Thrift datatypes and then gets deployed on Nimbus. In Java it is easy to serialize the object with its methods and data. So on the other side Nimbus just needs to create objects and invoke them. (i might be missing detail here but I hope I got the point correctly)
But I wonder how to write the topology in C++ and deploy it the same way. Does thrift help to serialize the c++ based topology and Nimbus deploys/executes the topology in the same way as for Java?
I have seen the links link1 link2 in this regard and the only solution seems to be using a Shelbolt. which invokes the process and communicates with it over standard i/o.
In order to use the Thrift way, do we need to rewrite the storm core also in C++? Also why use Thrift when it supports only JVM languages? Thrift doesn't seem to be used at all for languages like python/c++.
I'm not sure if I'm understand your question correctly -- in my understanding you're asking Is it possible [without the Shebolt hack] to use Storm [with Thrift as comm protocol] with C++-written bolts and with C++ as the language that creates the topology.
Because of the lack of other answers to this question and based on my own research I assume there is no finished, usable implementation for your problem.
Therefore if you really have to use Storm (its common usecase is the JVM, so even if it could theoretically work with any language, it doesn't mean there is an ecosystem for other languages) and C++, you have no option but to use the Shebolt hack or modify Thrift yourself.
As you know, thrift itself has also been ported to C++. Therefore it is possible to re-build the API calls in C++. Basically, you'd need to port the Java TopologyBuilder. On the C++ side, you could start with the Thrift C++ tutorial.
This is also some kind of a hack, as you basically just rebuild half of the stack (in this case ontop of Thrift), but in general you have very few other options with a system design like Storm.
For example, the MySQL binary protocol has been rebuilt from-scr
Unless anyone has done the work for you (which I would have completely missed in my research) I see no option than to do it yourself (maybe even storm is not the best tool for your usecase!?)
If another hack (which might be even more complex and maybe even slower) besides ShellBolt is good enough for you, you could try starting a JVM from inside C++, e.g. see this SO post. I would not recommend this.
If you need an alternative distributed task queue, I have had good experience with Celery in Python environments, however I have no experience in using it in C++ directly (I usually control Python with ZeroMQ, or write my own ZeroMQ-based queues where necessary, but this is no universal solution).

MPI or Asio for wide-area plugin-based message passing

I'm writing a distributed system wherein each node interfaces with local applications via some RESTful API, supports extensions and runtime customization, etc. It's a bit like an Enterprise Service Bus over the wide area, but with a lot else going on which is not related to the question at hand.
I've read a little about both MPI and Asio - originally I was set on Asio, but then I found MPI, and now again I'm thinking Asio is the better solution for me. MPI seems to provide a lot I don't need and a higher level of abstraction than I want - for example, I only need point-to-point communication, and it is important to me to be in control of when and what data is transmitted. (e.g. I have already designed a packet structure that I would conform to ideally)
So my primary question: it is worth it to start from a lower level with Asio, or should I try to graft MPI onto what i'm looking for? Further, are there 'skeleton applications' available which use MPI or Asio which would aid development? (Actually I am 100% new to C++.. ;) Or, does it make sense to use them in tandem?
For more perspective, maybe it's worth noting that I already have implemented the bulk of this project in Perl using Perl Object Environment, which itself is just an asynchronous event system with a ton of networking libraries.
Also, if it makes a difference, I would ideally use threads for this.
Honestly though I have not used Boost at all yet, as I hinted above, so any input is appreciated.
I should start by saying that I know nothing about Asio, but from the 2 minute scan of the website and the description of your problem, it sounds like while either would probably work for you, Asio might be simpler. MPI is really designed less for general purpose network communication and more for running applications where the set of processes and applications is a little more static. While it provides a client/server style interface if desired, it's not the main focus of the library.
MPI is also more difficult to use if you already have a packet structure designed. MPI is great for abstracting away the need to worry about packets, location of processes, etc. but if you've already taken all of that into account in you application, you have already done the hard work.
There have been at least one other discussion of Asio vs. MPI that you can take a look at (For distributed applications, which to use, ASIO vs. MPI?) to get more opinions too.

how to read write labview network shared variable from c++

LabVIEW gives the possibility of sharing variables over the network. I would like to be able to read and set those variable from my C++ code. (I run under linux system)
I read there are some DLL API for communication but of course they do not fit my purpose.
I guess we the whole communication should be simply based on sockets and therefore I guess should be more than feasible from linux environment.
Does anyone have some information/ideas about this topic?
It's not very easy to find it on the website but I have been pointed out to an official library, NI LabWindows™/CVI™ 2009 Help - Network Variable Library, that should do all the magic.
I haven't tested it yet though.
Looks to me like they only support interop with C++ on Windows.
You'd have to reimplement the entire crosstalk mechanism yourself, by reverse engineering their comms protocol. Not trivial!
Having no way to implement LV shared variable protocol (as Tomalak's post says), your best bet to enable communication between both would be to
use another messaging protocol, like ZeroMQ, and make bindings for LabVIEW.
use raw TCP or UDP sockets, both being supported in LabVIEW and C++

Is there a C++ implementation of Node.js Net API?

Node.js has a very good and well thought Net API.
I wonder is there a good C++ only implementation of that API as for example LuaNode do for Lua?
Take a look at node.native - attempt to implement api similar to node.js core lib, but with c++11 (and evented IO is also based on libuv)
There is nothing very similar that I know of.
However there are several reactor frameworks out there which give the same event queue driven environment. For example boost::asio provides an event queue that makes callbacks to handle network events, timers, and arbiatary events that you push onto the event queue.
It's largely the same idea, used in the same way. Howver it's nowhere near as simple as node.js to get started with, and does provide any non-blocking functions other than the basics I said above.
It does provide you with the environment to build your own system though. It's an excellent library, but probably rather lower level than you are looking for. There are other simiar libraries such as ACE and parts of the POCO c++ libraries too, but again, they are lower level than node.js with much less library support.
edit:
I've not looked at it too much but how about this https://github.com/joyent/libuv . This is a library that is used to implement some of the node.js features in a cross platform way. Maybe it's possible to use some of it for what you need?
Boost.Asio is conceptually very similar to Node.js. The primary difference being Asio is implemented as a library and Node.js is a language construct. Asio therefore exposes the event queue, requiring some initial setup to post callback handlers, and eventually a blocking call to start the event loop (io_service.run()).
If you're looking for a pure C++ API similar to Node.js, Boost.Asio is definitely the way to go. It is the de-facto networking library for many C++ applications. It's also discussed heavily on SO in the boost-asio tag.
I'm quite sure you could embed a Javascript engine into your program
v8 (building guide)
SpiderMonkey (building guide)
Actually tying that to your C code needs tinkering with the eval functions of both, but I think I remember seeing sample programs doing that for both engines

Scalable server framework in C++

I am looking to write a server application in C++ that is meant to handle tens of thousands of clients simultaneously. It should run under Windows and Linux. I have been looking around for frameworks and libraries and have come across Boost Asio, which seems like a highly mature and widely used alternative. I just have trouble wrapping my head around strands/thread pools, mainly because of the millions of templates. My background is mainly in C, so am not really used to the template mess that Boost in general seems to be full of. I tried to find someone to develop a relatively thin wrapper around Boost Asio that would take care of the threading/synchronization aspect using strands, bind and the like, but have been unable to find someone yet who can do it within my budget (2 or 300 US dollars).
Can any of you recommend any other libraries that scale as well as Boost Asio (e.g. with IOCP on Windows and epoll on Linux etc), or a source where I might find skilled Boost developers looking for smaller freelance jobs?
Thanks very much in advance for any help.
Kind regards,
Philip Bennefall
Best 4 choices i know
I really like zeromq.. but libuv seems interesting.. (libev and libevent are very nice too)
zeromq
libevent (as said)
libev
libuv (Its purpose is to abstract
IOCP on windows and libev on Unix systems and it is node.js network layer)
ACE is the framework you are looking for. Even boost Asio is just an implementation of Proactor pattern, which was introduced by Douglas C. Schmidt. He is best known as the author of POSA Vol.2 and the creator of ACE framework.
The Boost.Asio library offers side-by-side support for synchronous
and asynchronous operations ... based on the Proactor design pattern
[POSA2].
Although it is a cross-platform C++ network framework and uses template,
just simple template is used. (or not at all)
My background is mainly in C, too, and I don't like Boost's massive template-programming style. However, ACE wasn't like that.
Try libevent on for size. Its whole raison d'etre is to address the C10K problem. I'd say it's probably more lightweight than boost.
Try Pulsar Server Framework. Main benefit is it is built over libuv network library (used by node.js) that uses asynchronous I/O based on event loops.
It’s perfectly scalable. You can just go adding servers as your user base increases.
It is designed to work with server farm.
Highly configurable and easy to use
Currently it has been built for Windows x64 server.