So, I have a long-running Ruby process, that does a wide variety of things, depending on what's it told to do (EventMachine TCP server with binary messages). Now, I would like to give certain people the ability to monitor, change, shut down the given process via a web interface. I plan on using Sinatra.rb for that, however I am open to better alternatives.
My original idea was to run the Sinatra web interface (it's based on Rack, for those who're not familiar with Sinatra) inside a Thread
and let it run in the background.
However, I was thinking it might impact performance if I do it that way, so I decided to look into IPC abilities and alternative implementations for Ruby (resque, memory sharing, named pipes, etc).
I really liked the idea of resque (and the name is really witty), but I am not entirely sure if it's what I need, or if it may be overkill. Actually, I am not even sure how I would best implement it with Sinatra and EventMachine (although, I didn't read the full documentation for resque, just scanned through it quickly and read the examples and use-cases.).
Another idea that came to mind is using Sinatra inside EventMachine::defer
, but isn't that essentially the same as creating a new Thread
?
I have never done anything serious using Fiber
s, so I don't know their full potential, but they did cross my mind.
So, which of those (or suggest a better) practices is the best for Ruby PCI.
Thanks