Dramatic improvement by replacing ActiveRecord loop with single SQL query

Chris Downey

Founder, VaxCalc Labs and creator of Autovist and the Vaccine Ingredients Calculator.

Autovist’s worker process started producing hundreds of Heroku R14 “memory quota exceeded” errors:

But we haven’t added any new jobs recently.  What’s going on?

Continue reading “Dramatic improvement by replacing ActiveRecord loop with single SQL query”

Pre-calculating vaccine ingredients: from PostgreSQL to HTML data-*

Chris Downey

Founder, VaxCalc Labs and creator of Autovist and the Vaccine Ingredients Calculator.

The VIC pre-calculates ingredient amounts in order to dramatically speed-up performance.  This article describes how its done and why AJAX would be the absolute worst way of doing dynamic calculations on a complex set of variables.

The VIC delivers a tiny database to the browser inside the Ingredient Report page. The data is stored as HTML data-* and the engine is Javascript. “By adding data-* attributes, even ordinary HTML elements can become rather complex and powerful program-objects.” [1]

Once the Ingredient Report is loaded…

Continue reading “Pre-calculating vaccine ingredients: from PostgreSQL to HTML data-*”

Keeping the Autovist Dashboard Fast… and a surprise discovery

Chris Downey

Founder, VaxCalc Labs and creator of Autovist and the Vaccine Ingredients Calculator.

While performance tuning the database to solve Dashboard timeouts, we made a surprise discovery about how tweets and their embedded URLs are actually being used.

Continue reading “Keeping the Autovist Dashboard Fast… and a surprise discovery”

Adding index reduces query from 80 seconds to less than half a second

Chris Downey

Founder, VaxCalc Labs and creator of Autovist and the Vaccine Ingredients Calculator.

After bringing the production database down to my local dev machine and restoring it in order to use the latest data to develop against, I could no longer load the Dashboard for my @VaxCalc account as it kept timing out. Autovist has posted more than 25,000 tweets for @VaxCalc tracking multiple broadcasts of each tweet, url clicks and RTs for each of the broadcasts. Was this large number of tweets killing performance somehow?

Continue reading “Adding index reduces query from 80 seconds to less than half a second”