Multi-Core Python: multiprocessing Vs. zeroMQ? -
i'd write python code loads data set input , analyzes it.
there 5 parallel processes analyze data -- each process processing data differently -- in unique way.
before processing begin, master script (the 1 'start' different sub-processes) define empty list.
i'd different processes write output same list mentioned above (meaning, each 1 of processes able directly manipulate list defined in master script).
meaning, if process1 changed first value of list, other processes (while running) see first value of list has changed.
i sense 2 different python modules can used solve problem: multiprocessing , zeromq.
are there reasons prefer 1 vs. other in case? answer change if -- instead of running master script on same server -- splitting processes between different (multiple) servers?
(if @ matters, using linux)
if these 2 choices , know sure you're going distributing load across multiple machines, zeromq 1 of 2 choices fits bill.
the python multiprocessing module distributing load across processes/cores on single machine. far know, there no networked protocol underlying multiprocessing module , indicated first paragraph in accompanying documentation.
zeromq can used similar inter-process messaging on single machine ipc protocol, has network-based protocols allows send messages between processes running on different machines well.
that said, question has slight tinge of xy problem since seem have arbitrarily narrowed choices 2 of many, many possibilities implementing distributed program using python.
edit answer here incorrect , can't delete accepted answer, converting wiki in case wants correct it. short story misread documentation in haste. python multiprocessing support inter-process communication on network boundary. 1 major difference zeromq zeromq designed platform agnostic mix client/server agents on different platforms whereas python multiprocessing batteries included option if client/server processes coupled python.
Comments
Post a Comment