29110

Ruby open shared memory block

Question:

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:

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 <a href="https://github.com/airbnb/hammerspace" rel="nofollow">https://github.com/airbnb/hammerspace</a>

Recommend

  • EventBus on Android: how to implement dynamic queues vs. class-based event subscription?
  • MSMQ on Azure Website
  • Gem::LoadError: Specified 'postgresql' for database adapter, but the gem is not loaded
  • Posting to Facebook Page through API as the page (with admin rights)
  • How can I detect errors in an HTML document fragment with Ruby?
  • Using Castle Windsor configuration files is it possible to delegate to another item declaration?
  • How to use i18t for texts in the source code of Angular project?
  • Remove xml tag during xstream parsing?
  • 500 internal server error in ruby on rails
  • How to not let setText crash/freeze my whole application? Even using SwingUtilities and Threads?
  • Google API client bug, sending locations
  • what is browser's native support according to selenium webdriver
  • Laravel 5.1 Multitenancy setup
  • record audio in HTML / js without Flash?
  • how to set id for each item in ListView
  • Google Maps getMap returns null
  • Cannot invoke my method on the array type int[]
  • Regarding starting the threads on a condition
  • Redirect STDERR in OPEN pipe comand. Perl Linux
  • How to access EntityManager inside Entity class in EJB3
  • Deleting and Updating values from a cusrsor adapter
  • req.body is undefined - nodejs
  • Opengl-es onTouchEvents problem or a draw problem? [closed]
  • Accessing IRQ description array within a module and displaying action names
  • Modifying destination and filename of gulp-svg-sprite
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • Symfony2: How to get request parameter
  • How can I estimate amount of memory left with calling System.gc()?
  • Akka Routing: Reply's send to router ends up as dead letters
  • Is there a mandatory requirement to switch app.yaml?
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • SQL merge duplicate rows and join values that are different
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • Getting Messege Twice Using IMvxMessenger
  • embed rChart in Markdown
  • LevelDB C iterator
  • Can't mass-assign protected attributes when import data from csv file
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app