Computer architecture
This course explains the hardware that runs your Ruby and Rails code. It covers the CPU and its fetch-decode-execute cycle, clock speed, cores and Ruby's GVL. It then looks at RAM, the Ruby heap and the garbage collector, followed by HDDs, SSDs and database indexes. The bus lessons cover bandwidth, latency and caching layers. The last lesson traces a Rails request from boot to rendered page and maps common performance problems to the component that causes them.
What you'll learn
- ✓How the CPU, RAM and storage pass data to each other
- ✓How the fetch-decode-execute cycle, cores and Ruby's GVL affect your code
- ✓How Ruby objects use RAM and how the garbage collector frees it
- ✓Why SSDs, HDDs and database indexes change query speed
- ✓How bandwidth, latency and caching layers shape performance
- ✓How to map common Rails problems to a hardware cause
What is a computer?
Every time you type ruby app.rb and press Enter, something extraordinary happens. Your human-readable Ruby code gets turned into electrical signals that switch billions of times per second inside silicon chips. But what is doing all that work?
Read the full lesson free →Curriculum
6 lessonsWhat is a computer?
Introduces CPU, RAM and disk through a kitchen analogy and traces how running a Ruby file moves data.
The CPU: your computer's brain
Covers what the CPU does, clock speed, cores, the fetch-decode-execute cycle and how Ruby's GVL limits threads.
RAM: the fast workspace
Explains volatile RAM, address spaces, the Ruby heap, garbage collection and using find_each to avoid memory overflow.
Storage: the permanent record
Compares HDDs and SSDs, the speed hierarchy, sequential and random access, PostgreSQL's buffer cache and database indexes.
The bus: how components communicate
Describes bus signals, bandwidth versus latency, the Von Neumann bottleneck and the caching layers found at every level.
Putting it all together
Follows Rails from boot through YARV bytecode to a full request and maps common problems to hardware.