Programming posts of interest
Table of Contents
:ID: B31DB651-BC64-41FB-9E28-6AEEF933F186
This is list a list of programming articles that I find interesting and may want to reference again in the future. For now I’m going to organize them by language and/or framework.
# Ruby
- Build concurrency control in Sidekiq: This tutorial article shows how one can leverage Redis to lock resources. It’s context is locking Sidekiq jobs, but it would be easily repurposed to lock anything. Also, worth noting, the paid version of Sidekiq (Sidekiq ENT) already has a unique_for option. The general pattern/algorithm this article demonstrates is also discussed in the Distributed locks with Redis docs.
- Configuring Puma, Unicorn and Passenger for Maximum Efficiency:
Shares advice for figuring out how many workers and threads to use for your
server configuration based on available CPU and memory resources. For
example worker_count = 1.5 x (n hyperthreads). There’s also an explanation
of forking and copy-on-write.
- To Thread or Not to Thread: An In-Depth Look at Ruby’s Execution Models Is another look along the same lines, but favors forking processes over spawning threads. It shows how CoW memory works and how to inspect metrics related to it.
- Ruby’s magical Enumerable module:
Shows how to make objects enumerable by creating a
LinkedList
class. See also Make something enumerable for another example. - Don’t waste your time on assets compilation on Heroku: A silly, click-baity title, but an interesting take on piping Rails assets to a CDN.
- Gemfile of dreams: Libraries we use to build rails apps: Evil Martians’ commonly uses Rails libs.
- Deconstructing ActionCable This is an explanation of how ActionCable works. There’s some information in here that might help demystify some things or at least reveal details not in the official guide.
- Explaining Thruster A post on discuss.rubyonrails.org about Thruster and different asset caching strategies using reverse proxies, CDNs, etc.
- The Rails Router (ebook) An e-book that covers the RoR router pretty thoroughly
# Javascript
- https://www.akshaykhot.com/using-hotwire-without-rails/: Explains how to use Hotwire (Turbo primarily) without the RoR framework. What’s nice about this is that it becomes very clear what Turbo is all about.
# Database
- https://shopify.engineering/how-to-introduce-composite-primary-keys-in-rails: Using composite primary keys in a multi-tenant environment to improve database read performance (at the expense of write performance).
# DevOps
- Deploying Ruby on Rails with Dokku: this is a kinda of ultimate guide for using Dokku. Includes deploying with docker.
- Drifting Ruby: Deploying with MRSK Screen cast of deploying with docker to Digital Ocean using MRSK. There’s a bunch of gotchas to set this up, so worth a watch. This can be used for deploying pretty much anywhere, even on prem. Servers need to be prepared in advance (eg, load balancer, app nodes, database server, etc.)
- AWS Aurora and RoR: Describes the challenges of reducing both application node and database bottle necks by using auto scaling techniques with EC2 and Aurora; and testing by doing performance tests and failovers. Required careful DB and connection pooling configuration.
- Load Balancing: A visual guide to load balancing strategies like round robin, least connections, PEWMA
# Web Development
- HTTP caching in RoR: While this is centered on RoR development, the post discusses quite a bit about HTTP cache-related headers.