Ruby open shared memory block

佐手、 提交于 2019-12-12 04:14:39

问题


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.


回答1:


You have a few options as gems, but I've never used them myself.

sysvmq implements System V IPC message queues.

posix-mqueues implements POSIX message queues.




回答2:


Maybe try hammerspace

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 https://github.com/airbnb/hammerspace



来源:https://stackoverflow.com/questions/41514903/ruby-open-shared-memory-block

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!