Ruby Video
Talks
Speakers
Events
Topics
Leaderboard
Sign in
Talks
Speakers
Events
Topics
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
RubyConf 2018 - Cache is King: Get the Most Bang for Your Buck From Ruby by Molly Struve Sometimes your fastest queries can cause the most problems. I will take you beyond the slow query optimization and instead zero in on the performance impacts surrounding the quantity of your datastore hits. Using real world examples dealing with datastores such as Elasticsearch, MySQL, and Redis, I will demonstrate how many fast queries can wreak just as much havoc as a few big slow ones. With each example I will make use of the simple tools available in Ruby to decrease and eliminate the need for these fast and seemingly innocuous datastore hits.
Date
Summary
Markdown supported
In the video "Cache is King: Get the Most Bang for Your Buck From Ruby" presented at RubyConf 2018 by Molly Struve, the focus is on enhancing application performance through effective caching strategies in Ruby. Struve, a senior site reliability engineer at Kenna Security, highlights that while optimizing slow queries is important, the quantity of fast queries can also significantly burden data stores like MySQL, Elasticsearch, and Redis, impacting performance. Key points discussed in the video include: - **Initial Optimizations**: Struve begins by sharing how her team improved performance by optimizing long-running MySQL queries and Elasticsearch searches, but still faced high loads due to excessive datastore hits. - **Concept of Local Caching**: Using a relatable analogy, she explains the importance of local caching by comparing frequent database queries to repeatedly asking a volunteer for their name versus writing it down. By caching data locally, applications can retrieve it significantly faster, reducing the load on data sources. - **Bulk Serialization**: Struve describes her experience with serializing over 200 million vulnerabilities a day and how switching to bulk serialization from individual queries dramatically reduced the number of database calls made, decreasing serialization time from six seconds to less than one second per batch. - **Local Caching with Redis**: The video further explores transitioning the cache strategy to reduce GET requests to Redis by utilizing a local Ruby hash to cache client index names instead, which resulted in a 65% increase in the speed of vulnerability indexing. - **Sharding Database and Gem Awareness**: Struve talks about sharding their MySQL database by client to reduce load and the importance of understanding how gems interact with database connections to avoid unnecessary external requests. - **Preventing Unnecessary Database Hits**: Finally, she emphasizes how to prevent unexpected database hits by ensuring checks are in place in the code to avoid executing unnecessary queries, ultimately enhancing overall application speed. In conclusion, Struve advocates for using simple Ruby methods to reduce network latency and improve application performance. Key takeaways from the video include the significance of bulk processing, leveraging local caching, and understanding database interactions within Ruby applications to enhance efficiency. By applying these strategies, developers can create more responsive applications while minimizing load on their data stores.
Suggest modifications
Cancel