Press enter to see results or esc to cancel.

Rails Introduction of Background Process

Qiscus web application is written in Ruby on Rails. It is an amazing framework to build modern web application. Previously, Phidecks is written in PHP (Codeigniter) until we pivot and thinking it was a good time to rewrite everything in Ruby.

As a semi-private discussion platform (which rapid conversation and discussion happen everytime and in real-time) , we need to ensure that Qiscus can handle request/responds very fast.  meanwhile, we need to make sure all the functions in Qiscus work.

In this kind of application we definitely need a server which can handle background process while still process the web engine. Fortunately, Heroku provide this kind of process and Rails make it easier.

Rails has plugin module called Delayed_jobs. It is very easy to setup and perform quite well and good enough to handle millions of data transaction in the background.

In what case we need this delayed_jobs?
Simple example of this usage:

User submit a post or message, and in the same time we have to give notification to all user related to the post and sending some email related to this event.  Actually it is possible to do everything in one Rails controller through Ajax, but that means user have to wait until everything finished to be able do the next event. For us, sacrifice user experience is not the option. By using Delayed_jobs, we can throw this notification and sending email things to the background and let the worker server handle this for us, meanwhile the user does not need to wait the background server to finish their work. The most important thing, the data will not lose because we will process that anyway. It is just the event that user send is being delayed in the worker server and process immediately after first process finish.

How is the implementation?
we will explain our sample implementation in the other blog post, so stay discuss with us!

Comments

Leave a Comment

Show Buttons
Hide Buttons