logo
episode-header-image
Aug 2022
50m 29s

Memcached Architecture | The Backend Eng...

Hussein Nasser
About this episode

Memcached is an in memory cache with one major feature be a transient cache. Memcached has a very simple design. It was originally designed to help with database load by storing the query result in memory to avoid further querying the database. By default it has no authentication, a simple text protocols, servers don’t talk to each other. This video discuss the architecture of the cache, design choices and have some critics of the design choices. I go through a demo at the end using docker, telnet and nodes. Enjoy

0:00 Intro

4:40 What is Memcached?

7:45 Memory management

16:00 LRU

25:17 Threading and Connections

30:40 Read Example

34:30 Write Example

36:17 Write and Read collisions

39:40 Locking

40:30 Distributed Cache

43:30 Memcached with Docker/Telnet/NodeJS

45:00 Spin up a Memcached Docker container and telnet

52:17 Memcached and NodeJS

56:15 Four Memached Servers with NodeJS

01:01:00 Summary

Resources

https://www.cloudflare.com/learning/ddos/memcached-ddos-attack/

https://holmeshe.me/understanding-memcached-source-code-IV/

https://github.com/memcached/memcached/blob/master/doc/protocol.txt

https://docs.oracle.com/cd/E17952_01/mysql-5.6-en/ha-memcached-using-threads.html

https://holmeshe.me/understanding-memcached-source-code-I/

https://docs.oracle.com/cd/E17952_01/mysql-5.6-en/ha-memcached-using-memory.html

https://support-acquia.force.com/s/article/360005256114-Memcached-in-detail

https://www.alibabacloud.com/blog/redis-vs-memcached-in-memory-data-storage-systems_592091

https://www.usenix.org/system/files/conference/nsdi13/nsdi13-final197.pdf

https://memcached.org/blog/persistent-memory-2/

https://memcached.org/blog/modern-lru/

Up next
Jun 13
kTLS - Kernel level TLS
Fundamentals of Operating Systems Course https://oscourse.winktls is brilliant.TLS encryption/decryption often happens in userland. While TCP lives in the kernel. With ktls, userland can hand the keys to the kernel and the kernel does crypto. When calling write, the kernel encryp ... Show More
22m 55s
May 9
The beauty of the CPU
If you are bored of contemporary topics of AI and need a breather, I invite you to join me to explore a mundane, fundamental and earthy topic.The CPU.A reading of my substack article https://hnasr.substack.com/p/the-beauty-of-the-cpu 
9m 38s
Apr 18
Sequential Scans in Postgres just got faster
This new PostgreSQL 17 feature is game changer. They know can combine IOs when performing sequential scan. Grab my database coursehttps://courses.husseinnasser.com 
27m 36s
Recommended Episodes
Dec 2023
#644: Amazon ElastiCache Serverless
In this episode, we’re diving deep into one of the recent announcements from AWS re:Invent, the release of Amazon ElasticCache Serverless. This new option allows customers to create a cache in under a minute and instantly scale capacity based on application traffic patterns. Jill ... Show More
18m 30s
Jan 2024
545: 3,062 Days Later
Kent Overstreet, the creator of bcachefs, helps us understand where his new filesystem fits, what it's like to upstream a new filesystem, and how they've solved the RAID write hole.Special Guest: Kent Overstreet.Sponsored By:Tailscale: Tailscale is a Zero config VPN. It i ... Show More
57m 15s
Apr 2024
753: Cache Ruins Everything Around Me
Scott and Wes dive into the cache problem, tackling user-specific data and caching security. From marketing A/B testing to content negotiation, they explore various challenges and solutions, including different URL/query parameters, edge logic, and client-side caching. Show Notes ... Show More
24m 7s
Aug 2021
#467: [INTRODUCING] Amazon MemoryDB for Redis
Amazon MemoryDB for Redis is the newest fully managed database service from AWS. Today, Nikki is joined by Zach Gardner, Specialist Solutions Architect at AWS, to introduce this new Redis-compatible, durable, in-memory database service. Learn why we built MemoryDB and dive into b ... Show More
29m 36s
Mar 2020
Easier Stream Processing On Kafka With ksqlDB
Summary Building applications on top of unbounded event streams is a complex endeavor, requiring careful integration of multiple disparate systems that were engineered in isolation. The ksqlDB project was created to address this state of affairs by building a unified layer on top ... Show More
43m 36s
Mar 2013
FLOSS Weekly 244: CakePHP
CakePHP makes building web applications simpler, faster and require less code. Build Quickly - Use code generation and scaffolding features to rapidly build prototypes. No Configuration - No complicated XML or YAML files. Just setup your database and you're ready to bake. Friendl ... Show More
1h 3m
Dec 2019
Building The Materialize Engine For Interactive Streaming Analytics In SQL
Summary Transactional databases used in applications are optimized for fast reads and writes with relatively simple queries on a small number of records. Data warehouses are optimized for batched writes and complex analytical queries. Between those use cases there are varying lev ... Show More
48m 7s
Jan 2022
125 - Object Caching Systems
DownloadWe are sponsored by audible! http://www.audibletrial.com/programmingthrowdownWe are on Patreon! https://www.patreon.com/programmingthrowdownT-Shirts! http://www.cafepress.com/programmingthrowdown/13590693Join us on Discord! https://discord.gg/r4V2zpCObject Caching Systems ... Show More
1h 14m
Sep 2023
Episode 486: High Performance PostgreSQL for Rails with Andrew Atkinson
If you love taking about databases, this is the episode for you. Ahead of the launch of his new book, High Performance PostgreSQL for Rails, Andrew Atkinson joined the show with special guest co-host, Pat Bair, to talk about why he wrote a book, why he focused on PostgreSQL and h ... Show More
31m 29s