piker icon indicating copy to clipboard operation
piker copied to clipboard

Cross-actor, shm, (tick) ring buffer

Open goodboy opened this issue 5 years ago • 3 comments
trafficstars

As part of the fsp subsystem design we're likely going to want to implement some shared memory systems for low latency multi-time frame calcs. I've started a couple design ideas about this in #98 but I do think for sure part of this system will require a fast ring buffer for numpy data:

Here's a starter list of projects to try after some very brief searching


committed to long ago

committed recently
  • 2020: pyring pure python impl and has a multi-proc c-types example
  • 2020: ringbuf looks to be built for real-time audio but is single producer/consumer (which is actually fine for our use case afaik) but is built as a cython wrapper around boost (ala C++) libs; numpy example looks good
  • 2021: redo of ringbuf in rust targeting some missing features with ctypes wrapping/integration for python
  • 2020: circular_buffer_numpy seems kinda like a simple wrapper around an array with "pointer" index references kinda like what i've rolled many times before.

futher resources

It may just end up we take a lang from #106 and implement one or try out some designs from above on the new SharedMemory type which has an example using a numpy array. An example wrapper for an older version of this from the scipy cookbooks is here.


disruptor style

The "lurkers" said LMAX already did this best with their disruptor project. I think we can make a very cool variant of this with actors, numpy and numba:

  • slickin paper
  • pump vid
  • there's more resources on the disruptor link :surfer:
  • data_pipe is another one to check out (though not sure it'll have numpy support at all).

As always, lurkers please chime.

goodboy avatar Aug 20 '20 03:08 goodboy

The "lurkers" said LMAX already did this best with their disruptor project:

  • slickin paper
  • pump vid
  • there's more resources on the disruptor link :surfer:

I think we can make a very cool variant of this with actors, numpy and numba.

goodboy avatar Aug 21 '20 16:08 goodboy

data_pipe is another one to check out (though not sure it'll have numpy support at all).

Looks to imply it has some disruptor style examples.

goodboy avatar Feb 25 '21 12:02 goodboy

This definitely can tie in with #192 @guilledk

goodboy avatar Jun 02 '21 16:06 goodboy