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.

Paul Graham inspired the creation of Redis

411 pointsby oneowlabout 6 years ago

19 comments

antirezabout 6 years ago
I want to clarify a couple of things. I'm not saying that Paul Graham invented this pattern. Actually after he mentioned it, I remembered a friend of my father to implement exactly that in QUICKBASIC in the late 80s :-) The point is that maybe the Redis design was already inside me, but I needed a trigger: I often think of good things after being triggered. And smart people are more likely to tell about good ideas, old and new. That was the point. Similarly I believe there are a lot of simple fundamental ideas that can be re-applied to today's technology, as the landscape changes many things become relevant again.
评论 #19499964 未加载
评论 #19502549 未加载
评论 #19499974 未加载
himynameisdomabout 6 years ago
Man, some of the comments on here are really disheartening. What's the deal with trying to humble people with long-winded, tangential counterpoints, gotchas, and condescending questions? Constantly proving one's intellect seems to be a prevailing theme on HN and I'm not seeing how it adds to the quality of the content. I'm sure someone will unearth the irony in this and let me know soon enough.
评论 #19505243 未加载
DonHopkinsabout 6 years ago
That&#x27;s exactly how HyperCard works, and we all know what inspired HyperCard!<p><a href="https:&#x2F;&#x2F;www.mondo2000.com&#x2F;2018&#x2F;06&#x2F;18&#x2F;the-inspiration-for-hypercard&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.mondo2000.com&#x2F;2018&#x2F;06&#x2F;18&#x2F;the-inspiration-for-hyp...</a><p><a href="https:&#x2F;&#x2F;twit.tv&#x2F;shows&#x2F;triangulation&#x2F;episodes&#x2F;247?autostart=false" rel="nofollow">https:&#x2F;&#x2F;twit.tv&#x2F;shows&#x2F;triangulation&#x2F;episodes&#x2F;247?autostart=f...</a>
michaelmcmillanabout 6 years ago
Hmm, I thought this pattern was really common? That is, appending everything to a file and reading back from the file when there&#x27;s a reboot. I constantly use it when a database (or redis for that matter) is simply overkill for my use case.<p>Here&#x27;s a 34 line implementation I use on a node production system. It writes struct-like JavaScript objects that represents events to disk. When reading it back I do a fold (or .reduce) to build the state.<p>And yes –– it could be way smarter (writing to memory <i>and</i> disk), but YAGNI has been working out pretty well so far.<p><pre><code> class EventStore { constructor(file) { this.file = file; this.cache = null; } async appendEvent(event) { &#x2F;&#x2F; Purge the cache for entries since we mutated the store. this.cache = null; return new Promise((resolve, reject) =&gt; { createWriteStream(this.file, { flags: &#x27;a&#x27; }) .on(&#x27;error&#x27;, reject) .on(&#x27;close&#x27;, resolve) .end(`${JSON.stringify(event)}\n`); }); } async readEvents() { if (this.cache !== null) { return this.cache; } try { const data = await readFile(this.file, &#x27;utf-8&#x27;); const lines = data.split(&#x27;\n&#x27;).filter(line =&gt; line); const events = lines.map(line =&gt; JSON.parse(line)); this.cache = events; return events; } catch (error) { return []; } } }</code></pre>
评论 #19499847 未加载
评论 #19500426 未加载
评论 #19502500 未加载
lucideerabout 6 years ago
To offer a slightly alternative perpective on this, I actually think this type of &quot;article&quot;&#x2F;(&quot;listicle&quot;&#x2F;&quot;tweetacle&quot;?) can have negative effects. In my mind, it lends credence to the very toxic notion of &quot;value of ideas&quot; over &quot;value of execution&quot;.<p>The former is something that has all sorts of knock-on effects: backward IP laws &quot;protecting&quot; ideas, perverse incentives within large corporations with outspoken &quot;idea men&quot; being promoted ahead of doers, non-technical founders with &quot;high-potential ideas&quot; sucking up investment and expecting to execute with technical hires on untested theories.<p>I&#x27;m not saying any of the above applies in this case of course, but the fact is that it is you who built Redis, not pg, nor many others who&#x27;ve had similar ideas, and I think writing the above tweet thread lends undue weight to many of above negative trends in our industry (and also in general in recorded history of IP&#x2F;invention-credit battles).
评论 #19500044 未加载
评论 #19500237 未加载
评论 #19502533 未加载
评论 #19502396 未加载
评论 #19503839 未加载
userSumoabout 6 years ago
The comment should probably be still around right? Does anyone have the link?
评论 #19499703 未加载
chrchrabout 6 years ago
“System prevalence[1] is a simple software architectural pattern that combines system images (snapshots) and transaction journaling to provide speed, performance scalability, transparent persistence and transparent live mirroring of computer system state.“ — <a href="https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;System_prevalence" rel="nofollow">https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;System_prevalence</a>
vshanabout 6 years ago
PG was also involved in the inception of Reddit: It was PG who gave Alexis and Steve the idea to make something like reddit, and also gave them the tagline &quot;the front page of the internet&quot;.[0] PG had vetoed their initial idea to create a food-delivery app and then called them back and asked them to come up with something new. [0]: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=5rZ8f3Bx6Po" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=5rZ8f3Bx6Po</a>
quadcoreabout 6 years ago
Actually, I wonder why we dont have yet a programming language and runtime which, after a shutdown, reload exactly like it was.
评论 #19500246 未加载
评论 #19504982 未加载
评论 #19501006 未加载
评论 #19503862 未加载
评论 #19505152 未加载
评论 #19502079 未加载
评论 #19500308 未加载
kukabyndabout 6 years ago
Paul Graham inspired many people. His Hackers &amp; Painters is something I enjoy going through now and then.
评论 #19502242 未加载
stretchwithmeabout 6 years ago
Doesn&#x27;t AWS&#x27;s Aurora database sort of work that way too?
评论 #19500547 未加载
konamicodeabout 6 years ago
I&#x27;d be keen to see a simple example of this pattern in Lisp (or another language). Does anybody have a good link?
评论 #19499534 未加载
评论 #19501733 未加载
评论 #19499860 未加载
toshabout 6 years ago
Redis is a great example for unbundling a pattern to a lib&#x2F;service&#x2F;business.
viachabout 6 years ago
Probably the next logical idea would be to apply to YC with Redis?
huaheabout 6 years ago
PG inspires as usual!
techie128about 6 years ago
<i>When the application would be restarted, reading back the log would recreate the in memory data structures. I thought that it was cool, and that databases themselves could be that way instead of using the programming language data structures without a networked API.</i><p>That is literally how databases work. In Memory + WAL + Data Files on disk. You could, in theory, live without the Data Files and just a big WAL.
评论 #19498902 未加载
评论 #19498824 未加载
评论 #19498829 未加载
threeseedabout 6 years ago
Strange title.<p>Does merely recalling a language pattern really count as inspiring ?
评论 #19498895 未加载
andy_pppabout 6 years ago
Of course Erlang has had ETS (and of course you can use gen_servers of various kinds for this) built in forever. Redis is fantastic but I think there have been many examples of prior art before this tweet!
评论 #19499663 未加载
评论 #19499676 未加载
jokoonabout 6 years ago
Is this really a brilliant idea though?<p>Everybody knows RAM became cheaper cheaper, while mechanical disk can&#x27;t be made faster, and SSD have reliability limits.<p>It seems entirely logical to expect databases to work on RAM first and then commit on disk for a large performance improvement.
评论 #19499625 未加载
评论 #19499683 未加载