The ZeroMQ manual has a good example of using ZeroMQ for multithreading inprocess (inproc transport). However, the example shows a trivial message payload, which is a string. Thus, the costs of serialization and de-serialization are small.
However, take an example of a large business domain object. This domain object can be serialized to represent XML. So, how ZeroMQ can be done for multithreading, if for communication with each thread it means that the domin object must be serialized in one thread sent to the inproc workflow in order to be de-serialized and act on the message payload. Would the costs of serialization and de-serialization deny any improvement in messaging performance?
I understand the advantages of this design, since in the future it is possible to scale all processors, through nodes, through networks, etc. But I got confused in the whole concept of "multithreading using ZeroMQ."
Another method might be to have domain objects stored in the cache, and simply pass the identifier to the worker threads that will retrieve the actual domain object from the cache. Is that what is intended?
Any precedent or best marks are welcome.
source share