---
title: "#358: How I Reduced My DB Server Load by 80%"
publication: "Ruby Weekly"
issue: 358
published_at: "2017-07-20"
canonical_url: "https://rubyweekly.com/issues/358"
---

#358: How I Reduced My DB Server Load by 80%

This week's Ruby and Rails news[Read this e-mail on the Web](http://rubyweekly.com/issues/358)

Ruby WeeklyIssue 358 — July 20, 2017

Richard Schneeman[How I Reduced My DB Server Load by 80%](https://schneems.com/2017/07/18/how-i-reduced-my-db-server-load-by-80/)How one line, hidden in a common ActiveRecord validation, caused large spikes in database response time and what to do about it.


Tom Van Eyck[Ruby Concurrency: In Praise of Condition Variables](https://vaneyckt.io/posts/ruby_concurrency_in_praise_of_condition_variables/)A complete rundown of mutexes, condition variables, and how to use them together to write efficient threading code in Ruby.


Simple ProgrammerSponsored[Announcing: How to Earn More as a Software Developer](https://simpleprogrammer.com/products/careerguide?utm_source=coopermedia&utm_medium=email&utm_campaign=career-guide&utm_content=2017-07-career-guide-launch-ruby-weekly)Technical knowledge alone isn't enough—increase your income by leveling up your "soft skills." Learn new skills faster, command more respect, find work you love, and earn what you're worth. Get the book for $0.99 (48 hours only).

[![Simple Programmer\](https://copm.s3.amazonaws.com/004ca97b.png)](https://simpleprogrammer.com/products/careerguide?utm_source=coopermedia&utm_medium=email&utm_campaign=career-guide&utm_content=2017-07-career-guide-launch-ruby-weekly)


Practical AI[Implementing Classification Using a SVM in Ruby](http://www.practicalai.io/implementing-classification-using-a-svm-in-ruby/)Continuing a series on AI in Ruby, how to implement a Support Vector Machine (SVM) to solve a simple classification problem.


Stefan Wintermeyer[Rails Web-Scale is Expensive](https://medium.com/@wintermeyer/rails-web-scale-is-expensive-b86facc11381)A response to last week’s [Is Ruby Too Slow for Webscale](https://www.speedshop.co/2017/07/11/is-ruby-too-slow-for-web-scale.html) that takes issue with Rails being fast enough.


Enclose.io[Enclose: Compile Your App Into An Executable](http://enclose.io/)It essentially bundles a Ruby interpreter along with your code into an executable, so not a compiler in the classic sense. [GitHub repo](https://github.com/pmq20/ruby-compiler).


Fred Heath[Nim for The Discerning Rubyist](http://www.bootstrap.me.uk/bootstrapped-blog/nim-for-the-discerning-rubyist)[Nim](https://nim-lang.org/) is a statically-typed language with lots of syntactic sugar that can be called from Ruby as shown in this post.


Jobs

- [Senior Rails Engineer at Bugsnag](https://www.bugsnag.com/jobs/?utm_source=rubyweekly&utm_medium=email)Bugsnag is used by engineers around the world to deliver higher quality software every day. Join our team and help build the future of error monitoring. Bugsnag
- [Full stack Ruby and Rails dev (remote)](http://jobs.ably.io/o/full-stack-rails-developer?utm_source=rubyweekly&utm_medium=email)We’re a growing realtime platform solving truly complex distributed problems for the developer community. If you enjoy challenging your grey matter and building great web services, apply. ABLY.IO

In brief

- [RubyKaigi 2017 (Sep 18-20 in Hiroshima, Japan)](http://rubykaigi.org/2017/?utm_source=rubyweekly&utm_medium=email) news 
[Speakers announced here](http://rubykaigi.org/2017/speakers).
- [Keep Ruby Weird 2017 (October 27 in Austin, Texas)](https://2017.keeprubyweird.com/?utm_source=rubyweekly&utm_medium=email) news 
Always a fantastic event.
- [Rails 5.1.3.rc1 and 5.0.5.rc1 Released](http://weblog.rubyonrails.org/2017/7/19/Rails-5-1-3-rc1-and-5-0-5-rc1-released/?utm_source=rubyweekly&utm_medium=email) news Official Rails Blog
- [Webinar: How to Become a Performance Driven Engineer](https://www.vividcortex.com/resources/how-to-be-a-performance-driven-engineer?utm_campaign=Ruby%20Weekly&utm_source=ppc&utm_medium=Webinar%3A%20Performance%20Driven) VividCortexSponsored
- [Implementing Inheritance with Parameters](http://rubyblog.pro/2017/07/implementing-inheritance-with-params?utm_source=rubyweekly&utm_medium=email) tutorial 
Ever wondered how `ActiveRecord::Migration[5.0]` works? Here’s how. Sergii Makagon
- [When Distributed Locks Might Be Helpful in Rails](http://docs.knapsackpro.com/2017/when-distributed-locks-might-be-helpful-in-ruby-on-rails-application?utm_source=rubyweekly&utm_medium=email) tutorial Knapsack Pro
- [A Few Helpful RSpec Hints](http://jakeyesbeck.com/2017/07/12/a-few-rspec-helpful-hints/?utm_source=rubyweekly&utm_medium=email) tutorial Jake Yesbeck
- [How to Safely Store API Keys in Rails Apps](http://blog.arkency.com/2017/07/how-to-safely-store-api-keys-in-rails-apps/?utm_source=rubyweekly&utm_medium=email) tutorial 
Pros and cons of four approaches to this issue. Arkency
- [Use Refinery as a Headless API-First CMS](https://medium.com/@bricesanchez/use-refinery-cms-as-a-headless-api-first-cms-3450b84d9ed1?utm_source=rubyweekly&utm_medium=email) tutorial 
The example creates a Middleman site as the presentation client for the Refinery CMS API. Brice Sanchez
- [An In-Depth Look at Ruby's Exception System](https://honeybadger.leadpages.co/exceptions/?utm_source=rubyweekly&utm_medium=email) 
Ruby's exception system is more powerful than many people realize. This book shows you how to get the most from it. HoneybadgerSponsored
- [Front-End Sadness to Happiness: The React on Rails Story](https://blog.shakacode.com/front-end-sadness-to-happiness-the-react-on-rails-story-at-goruco-2017-d63b8fd26ca4?utm_source=rubyweekly&utm_medium=email) story Justin Gordon
- [Audited vs Paper Trail: The Battle for Auditing & Versioning in Rails](https://revs.runtime-revolution.com/the-battle-for-auditing-and-versioning-in-rails-audited-vs-paper-trail-17ad0011ecd9?utm_source=rubyweekly&utm_medium=email) opinion Runtime Revolution
- [How to Interpret a Ruby Stacktrace when Debugging](https://gorails.com/episodes/debugging-how-to-interpret-a-stacktrace?utm_source=rubyweekly&utm_medium=email) video Go Rails
- [Creating Custom Rails Generators](https://www.driftingruby.com/episodes/creating-custom-ruby-on-rails-generators?utm_source=rubyweekly&utm_medium=email) video Drifting Ruby
- [Secure your Codeship builds with BrakemanPro for Ruby on Rails](https://documentation.codeship.com/general/integrations/brakeman-pro/?utm_source=BrakemanIntegration&utm_medium=rubyweeklysecondary) tools 
Codeship and BrakemanPro have partnered for a more secure devops workflow. CodeshipSponsored
- [inherit_gem: Share RuboCop Rules Across All of Your Repos](https://blog.percy.io/share-rubocop-rules-across-all-of-your-repos-f3281fbd71f8?utm_source=rubyweekly&utm_medium=email) tools Mike Fotinakis
- [Racecar: A Simple Framework for Writing Kafka Consumers](https://medium.com/zendesk-engineering/introducing-racecar-fdb5178bcafb?utm_source=rubyweekly&utm_medium=email) code Zendesk
- [KBSecret: A Secret/Password Manager Backed by Keybase](https://github.com/woodruffw/kbsecret?utm_source=rubyweekly&utm_medium=email) code William Woodruff
- [Spreadsheet Architect: Convert Ruby Objects to Spreadsheets](https://github.com/westonganger/spreadsheet_architect?utm_source=rubyweekly&utm_medium=email) code Weston Ganger
- [Twilio Releases Next-Gen Ruby Helper Library](https://twilioinc.wpengine.com/2017/07/next-generation-ruby-helper-library-release.html?utm_source=rubyweekly&utm_medium=email) code Twilio Blog

Curated by [Peter Cooper](https://twitter.com/peterc) and [Glenn Goodrich](https://twitter.com/ruprict), and published by [Cooperpress](https://cooperpress.com/).
Send feedback by simply replying to this mail.
Want to sponsor an issue? See our [media kit.](https://cooperpress.com/mediakit)
Want to post a job? Email us or [use our self-serve system.](https://booking.cooperpress.com/jobs)

[Unsubscribe](*|UNSUB|*) | [Change email address](*|UPDATE_PROFILE|*) | [Read this issue on the Web](http://rubyweekly.com/issues/358)

© Cooperpress Ltd. Office 30, Lincoln Way, Louth, LN11 0LS, UK
[Email policy](https://cooperpress.com/spam.html) [Privacy policy](https://cooperpress.com/privacy.html)
