3 ms·
I actually build minimal Redis clones in every new language or runtime, or when I want to explore threading models. It all started with https://github.com/rcar
by rcarmo 4y ago
I actually build minimal Redis clones in every new language or runtime, or when I want to explore threading models.
It all started with https://github.com/rcarmo/miniredis https://github.com/rcarmo/miniredis (which I forked to add and experiment with pub/sub), and I just found myself doing it again and again because Redis is the quintessential network service:
By implementing it, you learn about socket handling, event loop for a specific runtime, threading models, data representation, concurrency (if you want to do a multi-threaded version), etc. None of my "ports" are fully functional, but they all helped me sort out some of the above plus build tools, packaging, dependencies, etc.
It's "hello world" for core cloud native microservices, if you will (and without having to do REST or JSON stuff).
- sillysaurusx 4y agoRESP3 is really nice too. It should probably be required reading. There’s a lot of interesting / subtle design choices worth studying. https://github.com/antirez/RESP3/blob/master/spec.md https://github.com/antirez/RESP3/blob/master/spec.md The best parts still haven’t been implemented.
- rcarmo 4y agoDepends on how much time I have. The Python tests work, so I’ve re-used them a couple of times. Sometimes I also explore the native testing.
- mLuby 4y agoI'm curious if you re-use the same tests across different languages? And is it actually on a network or are you pretending?
- helge5 4y agoI once built one in Swift 4, in part to see how multithreading via SwiftNIO and using copy-on-write datastructures would compare. It held up well against the C implementation, would be worth trying again against Swift 5.x. https://github.com/NozeIO/redi-s https://github.com/NozeIO/redi-s
- rapnie 4y agoIt might be nice to have Build Your Own web-ring.
- krenel 4y agoShameless plug; I've been playing with a [Redis Server implementation in Go](https://github.com/jan-carreras/ddia https://github.com/jan-carreras/ddia) for the past weeks. Mainly as a way to try out things explained in Designing Data-Intensive Applications book (favourite of mine!). Those are the [commands implemented](https://github.com/jan-carreras/ddia/blob/master/commands.md https://github.com/jan-carreras/ddia/blob/master/commands.md), + TTL + AoF files (for state replication) + config file, ... The "challenge" was to do it without any external dependency other than go stdlib. > I actually build minimal Redis clones in every new language or runtime, or when I want to explore threading models. 100% agree with your advice; I'll definitively try to implement other parts of the Redis service in Go (eg: pub/sub, replication, clustering...) and probably repeat the same exercise when learning any new language.