Search code examples
ruby-on-railsscalabilityobserver-pattern

Observer scalability (Achievement system) in Rails


Tried to find an answer about this but didn't find anything convincing on Google. I have over 80 observers in my application and was wondering if that could cause potentially trouble in the future ("it's always running") in any ways (traffic, scalability, sloppy application, real time, responsiveness, etc.).

And if there is? any elegant solutions.

Thank you.


Solution

  • It seems that you have a need for a substantial amount of post-action tasks. You may want to look into background workers instead, if you don't mind the overhead. Background workers will also keep your app responsive since observers are synchronous. You may want to look at beanstalkd and its client for lightweight background workers, the only price to pay would be failure conditions if they fail. You'd need to handle that in your logic somehow.