Last year we shared with you information about the most popular cloud services, AWS vs Heroku comparison. Now, when you mastered these tools, it’s time to present you Rails and Heroku tools to clean up slow database issue. And how do you usually investigate the performance of your application?
data.heroku.com provides insight into slow queries that may be impacting the performance of your application. Selecting the database and navigating to the Diagnose tab will display queries for each of these categories:
- Most time consuming
- Most frequently invoked
- Slowest execution time
- Slowest I/O
Here what we recommend you to perform:
- Make sure you’re doing your best to generate an efficient query with ActiveRecord and you’re still finding that a specific query is slow, you may benefit from adding an index.
- Let Rails do index properly for you. Use correspondant commands to generate a migration.
- Caching the results from your database queries is important to a production web application. It’s very unlikely that you’re reading new information every time your app queries the database.
- When you’re caching the data for your profile page you’re going to need a fast place to store it. There’s no point in caching if it isn’t significantly faster to retrieve something from the cache than it is to go to the database.
- You can make a lot of performance progress by identifying your bottlenecks, writing smarter queries, and caching.
Find more examples in this great material.
And don’t miss our ‘Monthly trending Ruby on Rails repositories. There you will explore a great serialization solution, Ruby autoformatter, GitLab CE Mirror, toolkit for file attachments, collaborative knowledge-exchange platform, Object Oriented DOM Tree and many other awesome repositories… Plenty of useful stuff from the Ruby/Rails world!
Btw, we have Telegram! Join to get all the important updates instantly!