---
title: "Building HTTP servers from scratch in Ruby 3"
publication: "Ruby Weekly"
issue: 563
published_at: "2021-07-29"
canonical_url: "https://rubyweekly.com/issues/563"
---

Plus running Ruby scripts on Kubernetes clusters, an alternative ActiveJob backend, 2D app building, RubyMine 2021.2, and more. |        

#​563 — July 29, 2021 

[Read on the Web](https://rubyweekly.com/issues/563)    

Ruby Weekly 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60/csdfn3nxvztim4zgdqfi.jpg)](https://github.com/hschne/rails-mini-profiler)  

[Rails Mini Profiler: Performance Profiling for Rails, Made Simple](https://github.com/hschne/rails-mini-profiler) — Rails Mini Profiler provides detailed information about your requests to help you figure out why certain requests perform poorly. Inspired by [rack-mini-profiler](https://github.com/MiniProfiler/rack-mini-profiler) which you can use more generically on Ruby web apps and APIs. 

Hans-Jörg Schnedlitz   

[Building an HTTP Server in Ruby 3 with Fibers and Ractors](https://www.dmitry-ishkov.com/2021/07/http-server-in-ruby-3-fibers-ractors.html) — This is part of [a broader series](https://www.dmitry-ishkov.com/2021/07/ruby-http-server-from-ground-up.html) about building an HTTP server in Ruby ‘from the ground up.’ Here, Dmitry shows the difference between approaches involving single and multi threads, fibers, and ractors (though it’s still very early days there). 

Dmitry Ishkov   [![\](https://copm.s3.amazonaws.com/3c204179.png)](https://blackmill.co) 

[Learn, Grow and Empower Your Engineering Team](https://blackmill.co) — Grow your leadership skills and build a healthy team culture that delivers business results. Our Leadership Hub, Workshops, and Tech Leadership Coaching help new and experienced managers anticipate and overcome everyday challenges. 

Blackmill sponsor   

[RubyMine 2021.2 Released](https://blog.jetbrains.com/ruby/2021/07/rubymine-2021-2-ruby-rbs/) — RubyMine is a popular (but commercial) Ruby IDE offering refactoring, debugging, code assistance, and numerous other conveniences out of the box. This new version can lean on Ruby 3’s RBS signatures to provide even better code completion. 

JetBrains   

[Making Rails Run Just a Few Tests Faster](https://world.hey.com/jorge/making-rails-run-just-a-few-tests-faster-2c82dc4b) — Jorge created a (now merged) pull request to Rails that only enables parallel testing if the number of tests is above a threshold that justifies the overhead. 

Jorge Manrubia (Basecamp)   

**IN BRIEF:** 

- Sebastian Wilgosz has plotted [a dependency graph of gems in the dry-rb family](https://hanamimastery.com/articles/dry-rb-dependency-graph) to see just how self contained they are.
- [Crystal](https://crystal-lang.org/) – a static, compiled ‘cousin’ language of Ruby – is [getting an irb-esque REPL and Pry-like debugger](https://github.com/crystal-lang/crystal/pull/10910) which will make it easier for us to fidget with it.     

Jobs  

[Backend Engineer | Remote Within CET (-2/+2 Hours) | Full-Time](https://jobs.lever.co/qonto/284b8162-5293-4ad7-a9e6-4ad26ce0c516?lever-origin=applied&lever-source%5B%5D=Cooperpress) — Join us as a Backend Engineer to create the finance solution all businesses love - Tailor made remote policy or relocation package. 
Qonto   

[Senior Software Engineer (Remote in the US)](https://grnh.se/bf97c4df4us) — Snapdocs is now a [Unicorn](https://snapdocs.com/press/snapdocs-named-to-the-2020-cb-insights-fintech-250-list-of-fastest-growing-fintech-startups/) with a $1.5B+ valuation. We’re a SaaS product disrupting the mortgage and real-estate industry. Join our growing distributed team. ROR, Go, Postgres, React, AWS. 
Snapdocs   

[Find Ruby Jobs with Hired](https://hired.com/join/?utm_source=newsletter&utm_medium=sponsor&utm_campaign=%28b2c%29%28l-all%29%28r-all%29%28cooper-rubyweekly%29&utm_content=find-your-next-job) — Create a profile on Hired to connect with hiring managers at growing startups and Fortune 500 companies. It's free for job-seekers. 
Hired    

📕 Articles & Tutorials  

[All You Need to Know About Netcat (`nc`)](https://blog.ikuamike.io/posts/2021/netcat/) — This isn’t about Ruby specifically but if you’re on a POSIX-compliant OS you almost certainly have `nc` available and it’s well worth knowing how to use the _“TCP/IP / networking swiss army knife.”_ 

Michael Ikua   

[Webpack _All_ the Assets?](https://www.ombulabs.com/blog/learning/webpacker/webpack-all-the-assets.html) — With the release of Rails 6, Webpack was introduced as the default JavaScript bundler but what about using it to handle _all_ the assets in an app? 

Ariel Juodziukynas   

[A Quick Way to Run a Ruby Script in Kubernetes](https://kirshatrov.com/posts/quick-ruby-script-in-k8s/) — Need to run a quick Ruby script on a live Kubernetes cluster? It’s possible to do without creating a custom container. 

Kir Shatrov   

[Ruby Ractor Experiments: Safe Async Communication](https://ivoanjo.me/blog/2021/02/14/ractor-experiments-safe-async/) — It’s a few months old, but the example implementation of a buffered queue monitored by the sender to avoid memory exhaustion is still worth a study. 

Ivo Anjo   

[Crunchy Bridge: Fully Managed Multi-Cloud Postgres](https://www.crunchydata.com/products/crunchy-bridge/?utm_source=Ruby+Weekly&utm_medium=newsletter&utm_campaign=Bridge&utm_id=crunchy+bridge&utm_content=7-29-21) 

Crunchy Bridge sponsor   

[How to Ignore 'Bullet' in RSpec Tests](https://tosbourn.com/ignore-bullet-rspec/) — [Bullet](https://github.com/flyerhzm/bullet) is a tool for monitoring your app’s queries to find inefficiencies you can resolve in your code. But in testing it can sometimes have false positives you need to silence. 

Tony Osbourn   

[Getting Partial AWS Account IDs for any Cloudfront Website with Ruby](https://arkadiyt.com/2021/07/09/getting-partial-aws-account-ids-for-any-cloudfront-website/) — Not sure this is very useful but it’s an interesting parlor trick. 

Arkadiy Tetelman   

[Rails 7 Adds Change Tracking Methods for `belongs_to` Associations](https://blog.saeloun.com/2021/07/27/rails-7-belongs-to-change-tracking.html) — It’s a minor change but reads better. 

Swaathi Kakarla   

▶[Discussing Observability with Charity Majors](https://www.bikeshed.fm/302) — Charity Majors, the co-founder and CTO of the Honeycomb observability platform, Co-founder and CTO of Honeycomb, an observability platform, digs deep into observability, its importance on a project, and how to do it right. 

The Bike Shed Podcast podcast  

🛠 Code & Tools  

[GoodJob: Multithreaded, Postgres-Based, ActiveJob Backend for Rails](https://github.com/bensheldon/good_job) — Complete support for async, queues, delays, priorities, timeouts, and retries with near-zero configuration. Some [recently added features](https://github.com/bensheldon/good_job/discussions/314) include a cron-esque replacement for recurring jobs and improved concurrency controls. 

Ben Sheldon   

[Ruby 2D: A Simple Cross Platform 2D App Library](http://www.ruby2d.com/) — We first mentioned this four years ago but progress has chugged along for this modest framework for building apps with graphics, audio, and input device support. [GitHub repo](https://github.com/ruby2d/ruby2d). 

Tom Black et al.   

[JetBrains RubyMine: A Cross-Platform Ruby & Rails IDE](https://blog.jetbrains.com/ruby/2021/07/rubymine-2021-2-ruby-rbs/?utm_source=cooperpress&utm_medium=cpc&utm_campaign=rubyweekly_rubymine) — Learn about the new features RubyMine 2021.2 brings for working with Ruby and RBS. 

JetBrains sponsor   

[Potassium: A Suspenders-Inspired Rails Application Generator](https://github.com/platanus/potassium) — Brings in things like dotenv, Yarn, Pry, FactoryBot, Puma, Rack Timeout, Faker, and more out of the box. 

Platanus   

[RailsAdmin 2.2: An Engine That Provides a Backend Admin Interface](https://github.com/sferik/rails_admin) — A Rails engine that gives you an easy interface for basic CRUD manipulation of data of your choice. Check out [the live demo](http://rails-admin-tb.herokuapp.com/). 

Erik Berlin   

[redis-rb 4.4: The Ruby Client Library for Redis](https://github.com/redis/redis-rb) — The official Ruby client for the [Redis](https://redis.io/) data structure server. 4.4 adds support for `XAUTOCLAIM` and `ZINTER`, plus a few bug fixes. 

Redis      

💡**Tip of the Week** 

**Ancestors in Ruby**   

Ruby's object model is fascinating! In the next few tips following this one, we'll look at different ways of using code from a `module` in a `class`: `include`, `extend` and `prepend`. 

In order to set ourselves up to understand the nuances behind each approach, we need to first understand Ruby's concept of ancestors, and how they are used. We'll use a small empty `Example` class to start: 

```
class Example
end
``` 

Now let's call `#to_s` on an instance of a `Example`: 

```
Example.new.to_s
=> "#<Example:0x00007fcc5997ec30>"
``` 

How did this happen? We never defined `Example#to_s`. [Ancestors](https://ruby-doc.org/core-3.0.2/Module.html#method-i-ancestors) are an ordered array of classes or modules that are included or prepended in a given module or class. Let's break that down. In this case, we can see `Example#ancestors`: 

```
Example.ancestors
=> [Example, Object, Kernel, BasicObject]
``` 

When Ruby is looking for a method defined on an object, it will traverse these ancestors in order looking for the method. So in our example, Ruby will not see `#to_s` defined on `Example`, and will traverse to look for it defined on `Object`. It is [defined on `Object`](https://ruby-doc.org/core-3.0.2/Object.html#method-i-to_s), so Ruby uses that! 

If we, however, do define it within `Example`: 

```
class Example
  def to_s
    "We created this!"
  end
end

Example.new.to_s
=> "We created this!"
``` 

We can confirm it will use our definition of `#to_s` within `Example` before defering to looking for `#to_s` later in the ancestors chain. Check out next week's tip to see how ancestors are relevant to `include`!    

This week’s tip was written by [Jemma Issroff](https://twitter.com/jemmaissroff).          

Curated by [Peter Cooper](https://twitter.com/peterc), [Glenn Goodrich](https://twitter.com/ruprict) and [Cooperpress](https://cooperpress.com/). 

[Change your email address](https://rubyweekly.com/edit_subscription/*|UID|*) or[Stop getting this newsletter](https://rubyweekly.com/leave/*|UID|*) 

© Cooper Press Ltd · Fairfield Enterprise Centre, Louth, LN11 0LS, United Kingdom
