Python Forum
Distributed size limited queue implementation?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Distributed size limited queue implementation?
#1
I am looking for some implementation of a queue that would work much like the multiprocessing.Queue but between different machines. It should have the following properties:
  • distributed, can connect processes on multiple machines via the network
  • thread / multiprocessing safe, can be written to or read from by multiple processes on multiple machines
  • !!! Limited size, can specify maximum size and will block writers when limit is reached
  • Blocking read, should block when empty until a new element arrives, unblock and allow reading from a random process of several that may be reading and block

The implementation could be based on redis or memcached.
Is there a library that supports this? Huh

(I original posted this in the general discussions forum by mistake Doh but I am unable to remove it from there, how can that mistake get cleaned up?)
Reply
#2
The library ZMQ, which has bindings to Python (pyzmq), is a message queue.
You can use: SUB, PUB, PUSH, PULL, REQ, REP
The Conncetion is handled in the background automatically.
For example a publisher can be a server or a client.

Asyncio is supported. If you don't use asyncio, the read-function blocks, until a
new message arrived. But you can still use NOBLOCK. You can use a Poller, but you don't have to.

I don't know the maximum size, but I use this for sensor-data in a Radar-System.
Currently i am working with a shape of (3, 256, 256, 2) with datatype uint16.
This data is sent every 100ms. No problems with it.
I work with this library very low level: sending multipart messages, where the first one is always the topic, followed by other segments with bytes. But there is also an abstraction for Python data type.

I use websockets and in the past, I got more problems with websockets (fragmentation, lost messages, blocking) as with ZMQ.
What you need to know: Never expose the ZMQ-Services to the internet. This is bad.
Companies in financial sectors are using zmq. One million messages per second is a normal workload in the financial sector.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  asyncio Queue implementation sentieri 2 2,008 Sep-16-2020, 07:30 PM
Last Post: DeaD_EyE
  isinstance() arg2 is limited to a type or a tuple of types Skaperen 5 3,877 Dec-02-2019, 06:07 PM
Last Post: Skaperen
  math.gcd() is limited to 2 arguments Skaperen 2 4,022 Aug-10-2019, 01:00 AM
Last Post: Skaperen
  Parallel processing and distributed computing with Python GarlicScience 5 4,687 Nov-26-2017, 11:07 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020