Question

I have two background processes running on linux machine. One is Java and second one is in Python. What would be most efficient way to exchange data between these two apps ? I am talking about text / images data below < 10Mb approx each 5 minutes (not streamed). Due high cost of refactoring we cannot migrate fully to Python (or Java).

Natural choice is filesystem or local networking but what about in memory database (sqllite/redis/...) ? Filesystem handling or network handling is sometimes painfull i guess.

Do you think that in-memory-DB would be good option for such task ? Jython is not option there as not all Python libraries are compatible...

Environment : ubuntu server 12.04 64bit, Python 2.7, Java 7

Was it helpful?

Solution 2

An efficient way to transfer the data would be a local TCP connection and stream the data with a common protocol. Protocol buffers is one way to define your protocol across language platforms. An in memory database would add a whole new component and unnecessary complexity to your system.

OTHER TIPS

Unix domain sockets would be the fastest since it won't use the disk and it doesn't have unnecessary overhead like TCP.

Given the relatively low volume of data you need, I would say the easiest way would be to use a TCP socket to communicate between the two processes. The data speed on the loopback interface is more than enough for your needs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top