3 ms·
A quick tip would be to run everything process intensive in the backend, don't waste frontend resources with API calls, data processing etc, got something that
by rprime 15y ago
A quick tip would be to run everything process intensive in the backend, don't waste frontend resources with API calls, data processing etc, got something that takes more than 200ms to run, place it in a job que and do the processing later.
Some tools for the job:
https://github.com/defunkt/resque https://github.com/defunkt/resque
https://github.com/tobi/delayed_job https://github.com/tobi/delayed_job
Also don't forget to cache. You shouldn't worry too much if you do these two properly.
- ha470 15y agoThanks! Using delayed job already for certain API calls, but will think about how to use them more. I think I definitely have to look into cacheing.
- rprime 15y agoBasically if one of your controller has more than 10 lines of processing and you don't need to present the data to the user immediately, you can put that into a job, for example when a user register, you can add the new record to the database and redirect him, but you can send the welcome email 1-2 minutes late. And for presenting data, yeah, go cache everything, also take a look inside rails partial cache features, for example in a page, even that the results are dynamically generated, you can cache things like categories for example, or the blog post, and retrieve just the comments.