Module 02 · From Scratch · Redis · about 15 min to read
Redis again, in Rust
One Thread Many Clients · Open board
: the board where one worker serves many clients. This lesson rebuilds that wall in Rust and checks it against the Go version.
Before you start. Capstone: Redis, Everything gave you the finished Go build: seven pieces crossed by one command. Redis: One Thread, Many Clients showed why many clients can share one table only if something guards it, and in Go that guard is a lock you must remember to take. Redis: The Map (SET / GET / DEL) gave you the table, a map from key to value. Reading Go in twenty minutes gave you enough Go to read the comparison. You need no Rust.
Lesson 12 of 117 in From Scratch
The rest of this lesson is part of a plan.
A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.
See plansAlready a member? Sign in
Or start free: a free account opens lessons 2 and 3 of every track.
In this lesson
- February 4, 2020: a spike every two minutes
- One value, one owner (ownership)
- A borrow is a loan with two rules
- Arc: many owners of one store
- A task is one client, and await is where it waits
- Send: the compiler checks which thread
- What changed, side by side
- The whole server
- Real output
- Option two: one thread, no lock
- Trade-offs and edge cases
- The setup note
Terms it explains: garbage collector, move, ownership, borrow, task, Send.
Review From Scratch
Saved in this browser, and to your account when you sign in.