This is normal, but 20 threads will appear in EM.defer, so I would avoid this in your use case. In general, I would completely avoid EM, especially the Java reactor, since we never finished it.
Torquebox has a built-in function stomp over websockets, which would be much better in this context and solves the problem with other encapsulation problems.
If you really want to stick with EM for this, then I would use Thread.new instead of deferring so that there are no 19 idle threads occupying the additional ram for no reason.
raggi source share