Is there a way to open shared memory block with Ruby, equivalent to
shmop_open in PHP?
I have one process periodically update a memory block. My Rails app needs to read those data.Answer1:
You have a few options as gems, but I've never used them myself.
<a href="https://github.com/Sirupsen/sysvmq" rel="nofollow">sysvmq</a> implements System V IPC message queues.
<a href="https://github.com/Sirupsen/posix-mqueue" rel="nofollow">posix-mqueues</a> implements POSIX message queues.Answer2:
We use this as a caching layer for translations and configurations on our production machines.
You can have one process that periodically updates the hammerspace files, and then all the rails processes can consume it. The file gets memorymapped when
hammerspace accesses it, so it is defacto shared memory.
See <a href="https://github.com/airbnb/hammerspace" rel="nofollow">https://github.com/airbnb/hammerspace</a>