Terence Lee and Jeff Casimir will give a quick introduction to the evening.
Understanding the Heroku Platform
- How a request is served on Heroku
- What is a "dyno"?
- Why concurrent requests matter
- Ceder & Webrick
- Understanding a Procfile
- Writing and deploying a Procfile
A Standard Procfile
A Puma Procfile
Using Foreman Locally
- You develop with insufficient data
- Query problems don’t stand out
- Two key problems
- Search Speed
- N+1 Queries
N + 1 Queries
1 2 3 4
- There’s no global solution for N+1
- Memory Cache
- Counter Cache
- Full-table reads are slow
- Primary keys, like
id, are the main lookup mechanism
- The database creates an index on the primary key automatically
- But if you use
find_by_(X)you need an index
- If you use
where, you need an index
- Creating an index
- Creating a compound index
1 2 3 4 5
- Why caching works
- Understanding a key-value store
- Caching fragments
1 2 3 4
- The expiry problem
- Ignore rather than expire
- Computing digests
During this session you need to put the ideas we’ve discussed into practice.
Clone the repository and install dependencies:
Then follow the notes and instructions in the
README.markdown to finish setup including loading the sample database.
Running the Tests
First, run the functional tests to make sure everything is working properly on your system:
Then start the server so it is available at the url you specified in
Then run the performance suite:
The tests should pass and result in a total runtime number at the end.
Improving the App
Let’s see what we can do to implement the techniques discussed to drive that total suite time down.
The suite should, at first, take about 50 seconds.
Then see if you can get the total time under:
- Bronze: 42 seconds
- Silver: 30 seconds
- Gold: 15 seconds
In addition to Heroku and Jumpstart Lab, we have great prizes from our friends at:
RailsCasts is produced by Ryan Bates (rbates on Twitter and ryanb on GitHub) featuring tips and tricks with Ruby on Rails. The screencasts are short and focus on one technique so you can quickly move on to applying it to your own project. The topics target the intermediate Rails developer, but beginners and experts will get something out of it as well.
Code Climate provides continuous code inspection for your Ruby app, letting you fix quality and security issues before they hit production.
After each Git push, Code Climate analyzes your code to identify changes in quality and surface technical debt hotspots. Urgent notifications are sent immediately via Campfire chat, email or RSS so you can address potential quality issues as soon as they occur.