DEV Community 👩‍💻👨‍💻

Discussion on: What is a preferred way to communicate Python (can be short-lived) and Node.js server (long running)

aquicarattino profile image
Aquiles Carattino

I am using ZeroMQ quite consistently for interfacing different languages or different programs. On the one hand, it makes it a breeze to work with sockets, etc. on the other, if you are sharing a lot of data very quickly, you have no control on queue sizes, etc. in order to balance the load or stop the publisher, etc. I am using it to stream data from 2 sCMOS cameras, and it can very quickly choke the computer.

If your python program is short lived, but you need to run it very often, you should be careful with startup and tear down times. Perhaps it would be better to have a long-lived process that is always eager for tasks.

What I like about ZMQ is that you have implementations in a myriad of languages, and therefore it can be easily extended in the future, if you ever need to add another language, or if you go distributed.