TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Redis explained

455 pointsby mgrouchyalmost 3 years ago

23 comments

btillyalmost 3 years ago
I think a few more concrete use cases would help.<p>First, a key limitation that every architect should pay attention. Redis reaches the limits of what you can do in well-written single-threaded C. One of those limits is that you really, <i>really</i>, *really* don&#x27;t want to go outside of RAM. Think about what is stored, and be sure not to waste space. (It is surprisingly easy to leak memory.)<p>Second, another use case. Replication in Redis is cheap. If your data is small and latency is a concern (eg happened to me with an adserver), then you can locate read-only Redis replicas everywhere. The speed of querying off of your local machine is not to be underestimated.<p>And third, it is worth spending time mastering Redis data structures. For example suppose you have a dynamic leaderboard for an active game. A Redis sorted set will happily let you instantly display any page of that leaderboard, live, with 10 million players and tens of thousands of updates per second. There are a lot of features like that which will be just perfect for the right scenario.
评论 #32428075 未加载
评论 #32429279 未加载
dtertmanalmost 3 years ago
At desktop resolution, the floating table of contents menu blocks out two of the (excellent) illustrations (second and second-last). Deleting aside.toc was very helpful.
评论 #32427184 未加载
googletronalmost 3 years ago
My personal nightmare happened and accidentally published a rough draft! It has since been updated! Apologies!
评论 #32434676 未加载
xnorswapalmost 3 years ago
&gt; Send 1KB over a 1GBps network<p>This is said to have a 10μs latency in the chart. But I&#x27;m fairly sure that is a calculation of bandwidth based on 1KB &#x2F; 1GBps<p>10μs is about 3Km, so at most a 1.5Km round-trip.<p>For a chart labelled latency, I&#x27;m surprised to see bandwidth calculations included. Any network hop would actually have far greater latency, if nothing else because communication typically involves more than a single round-trip for acknowledgement, etc.<p>It might be worth making it clear some of the numbers are about bandwidth not latency.
评论 #32427518 未加载
评论 #32427541 未加载
rfreyalmost 3 years ago
A question so noob I&#x27;m almost shy to ask it:<p>The simplest scenario in the article is a single Redis instance residing on the same machine as the application. What&#x27;s the benefit to this versus just storing data directly within the application?
评论 #32434258 未加载
评论 #32434058 未加载
评论 #32432816 未加载
评论 #32431885 未加载
评论 #32431914 未加载
评论 #32432030 未加载
评论 #32432000 未加载
_gmnwalmost 3 years ago
Really love this style of writing. Pairing the diagrams&#x2F;illustrations with the easy to grok copy is really helpful for folks like myself who have been mainly focused on the front-end.<p>What tool do you use for your diagramming, is it all hand-drawn?
评论 #32427208 未加载
评论 #32427505 未加载
googletronalmost 3 years ago
I wrote a little post on how Redis works and its various setups! How does everyone setup Redis? Elasticache is a good answer too :P
评论 #32427011 未加载
评论 #32430444 未加载
评论 #32428968 未加载
xnorswapalmost 3 years ago
I&#x27;m not too familiar with redis and this may well help, so thank you.<p>I see some data-types on the right. It surprises me that redis doesn&#x27;t have a numeric data type. I understand that at its heart it is just a key-value store and doesn&#x27;t ever need to do range-based lookup but it still surprises me.<p>One consequence of &quot;everything is a string&quot; I&#x27;ve run into (although probably a sign I&#x27;m &quot;doing it wrong&quot;), is serialisation overhead in the client.<p>If redis is expecting strings then it&#x27;s left to the client to choose an appropriate serialisation which can have either performance or other pitfalls.
评论 #32427389 未加载
评论 #32427689 未加载
评论 #32427632 未加载
jrm4almost 3 years ago
As someone who doesn&#x27;t code for a living but teaches it to mostly novices, this helps (because before this I had no clue what it was except that it had something to do with databases.) Typically for my courses we just use some flavor of SQL and call it a day (and that kind of spoils us because of how declarative it tends to be) -- roughly, what&#x27;s the &quot;explain like I&#x27;m 10&quot; use case for Redis over something else? From what I&#x27;m seeing, it&#x27;s mostly an &quot;efficiency&quot; thing?
评论 #32432404 未加载
评论 #32430804 未加载
评论 #32430916 未加载
评论 #32429956 未加载
评论 #32429979 未加载
thedenalmost 3 years ago
This is great, the visual explanations work really well<p>One thing that threw me off is that it says for an SSD a random read is 150μs, but 1MB sequential read is 1ms? Shouldn&#x27;t sequential reads be faster, or are two different read sizes being compared or something? If so, the ambiguity may confuse some people to think random reads are faster
评论 #32427285 未加载
评论 #32427317 未加载
omarshammasalmost 3 years ago
Very informative and love the illustrations.<p>I&#x27;m building a new website and am using sidekiq for background job processing which relies on redis behind the scenes to store all the job data. I configured a high availability redis instance with `maxmemory-policy noeviction` to ensure no data is lost.<p>The website is still in its infancy so not thinking about scale for the next little while but curious if you have any tips or gotchas to keep an eye out for. Thanks!
评论 #32437488 未加载
topspinalmost 3 years ago
I am thinking of using Redis as a lightweight queuing mechanism. An event source will MULTI a small amount of metadata as a hash and append a list. Event sinks will BLPOP the list and retrieve and delete the metadata key. One requirement is the events survive power loss.<p>Is there anything inherently wrong with this? Gotchas? A mockup I&#x27;ve done works great so far.
评论 #32428893 未加载
评论 #32429792 未加载
评论 #32429398 未加载
its_bbqalmost 3 years ago
I&#x27;ve been looking into tech stacks to make a collaborative editor and Redis CRDTs come up a lot. IIUC this requires a Redis db running in each users machine and they connect P2P with each other. Do I understand right? Anyone have good resources for this? I&#x27;ve also seen Riak come up as an alternative. Do they work similarly?
witnesseralmost 3 years ago
The only person stand out to witness a use case is a adserverer, I read the 1st 100lines of comments. It is like california highway system particularly when I witnessed, the billboard is very outstanding. The jams an pits, people are very nice to them.
评论 #32431294 未加载
anton96almost 3 years ago
Very interesting.<p>This is leading me to think, using redis as the sole database is very tempting but the Ram requirement is making me think twice.<p>Wouldn’t there be a database like redis that only stores the latest data into memory and keeps the rest in an AOF file ?
评论 #32429759 未加载
claytnalmost 3 years ago
It&#x27;s not clear to me why it makes sense to use both RDB Files and AOF on the same Redis instance. Seems like AOF would always be the more accurate source of truth here. What am I missing?<p>Great article though!
dsmmckenalmost 3 years ago
Beautifully presented, worth reading just for the illustrations.
Havocalmost 3 years ago
The white cube in the traditional usage example - what does that represent? App code? Or so that cache miss to db implemented in some standardized way?
thecosmicfrogalmost 3 years ago
Excellently written and illustrated! We&#x27;ve just added Redis to our platform so guides like this are a fantastic resource. Thanks!
groffeealmost 3 years ago
It&#x27;s a good article, but a couple of hopefully constructive points<p>1, .toc-wrap covers the image on desktop<p>2, the image is way too busy, there&#x27;s too much going on
ptbgalmost 3 years ago
I love this style of post. You cover a wide range of topics in an easy to understand way. Keep up the great work!
didipalmost 3 years ago
By the way, if you want a painless multi master Redis, simply install KeyDB.<p>I am not affiliated, just a happy user.
tunesmithalmost 3 years ago
In what cases would one want to pick memcached instead of redis?