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.

Tower Defense: Cache Control

66 pointsby jasonthorsness5 days ago

8 comments

grep_it1 day ago
&gt; Why Not Redis? I have a single VPS, so I can get by with a simple SQLite database. If I had many instances of my API on separate servers<p>Just to push against this a bit. Redis can be very low memory cost and is very easy to run (I give it 5mb). I have a small single server with a few instances of my API that let&#x27;s me cache pretty much everything I need.
评论 #44010089 未加载
评论 #44008331 未加载
评论 #44008825 未加载
harrall1 day ago
Read your CDN docs very carefully on how it processes requests. Make sure that your CDN does request coalescing.<p>At my previous job, I became responsible for handling &gt;350,000 requests&#x2F;second and I dug so deep.
评论 #44014256 未加载
ec1096851 day ago
Regarding stale-while-revalidate, the author calculates maximum load like this: “With the options available on hn.unlurker.com, there are only 10 * 12 * 8 * 2 or 1920 possible combinations, refreshed at most once every 15 seconds”<p>That math works until it doesn’t. If for some reason there’s a greater than 15 second response, the cache will open the floodgate and won’t return any cached response until the cache is full.<p>Similarly, errors need to be accounted for. If the server returns a 500, is it configured to be cached? Is stale-while-error configured so the error state doesn’t take the server down?
评论 #44008459 未加载
评论 #44007741 未加载
kawsper1 day ago
&gt; stale-while-revalidate is a relatively recent cache-control option<p>Varnish Cache have supported that since version 4.1, it was released 2015-09-30:<p>&gt; Varnish will now use the stale-while-revalidate defined in RFC5861 to set object grace time.<p><a href="https:&#x2F;&#x2F;varnish-cache.org&#x2F;docs&#x2F;trunk&#x2F;whats-new&#x2F;changes-4.1.html" rel="nofollow">https:&#x2F;&#x2F;varnish-cache.org&#x2F;docs&#x2F;trunk&#x2F;whats-new&#x2F;changes-4.1.h...</a>
评论 #44011384 未加载
tikotus1 day ago
I&#x27;ve been running a handful of low traffic services on a $10 VPS from DigitalOcean for years. I&#x27;m currently in a situation where a thing I&#x27;ve made might blow up, and I had to look into CDNs just in case. It&#x27;s just static content, but updates once per day (it&#x27;s a daily logic puzzle).<p>I must admit I had no idea what goes into runnig a CDN. First I had a look at DO&#x27;s spaces object storage which has CDN support. But it wasn&#x27;t exactly the right tool for serving a static website apparently, but rather for serving large files. For example I couldn&#x27;t make it serve css files with the correct mime type without some voodoo, so I had to conclude I wasn&#x27;t doing the right thing.<p>Then I looked at DO&#x27;s app platform. But that seemed like an overkill for just sharing some static content. It wants me to rely on an external service like GitHub to reliably serve the content. I already rely on DO, I don&#x27;t want to additionally rely on something else too. Seems like I could also use DO&#x27;s docker registry. What? To serve static content on CDN I need to create a whole container running the whole server? And what do I need to take into consideration when I want to update the content once per day simultaneously for all users? It&#x27;s easy when it&#x27;s all on my single VPS (with caching disabled for that url) but I actually have no idea what happens with the docker image once it&#x27;s live on the &quot;app platform&quot;. This is getting way more complex than I was hoping for. Should I go back to the spaces solution?<p>Right now I&#x27;m in a limbo. On one hand I want to be prepared in case I get lucky and my thing goes &quot;viral&quot;. On the other hand my tiny VPS is running on 2% CPU usage with already quite a few users. And if I do get lucky, I should afford doubling my VPS capacity. But what about protection from DDoS? Anything else I should worry about? Why is everyone else using CDN?<p>And I don&#x27;t even have caching! An article like this puts my problem into shame. I just want to serve a couple of plain web files and I can&#x27;t choose what I should do. This article really shows how quickly the problem starts ballooning.
评论 #44009193 未加载
评论 #44008910 未加载
评论 #44009583 未加载
nisten1 day ago
Where&#x27;s the fucking game, I was teased with a potential of a vibecoded game!
评论 #44007280 未加载
arjie1 day ago
My blog is on a totally overprovisioned VPS and I use Cloudflare to cache responses for non-logged-in users. I&#x27;m using Mediawiki because I want people to be able to edit it and sometimes it can be extraordinarily slow but with Cloudflare it loads instantly if someone visited it some time recently. I really like Cloudflare&#x27;s caching control.
nixpulvis1 day ago
I&#x27;ve always wondered if it would be worth the effort to display information to the user to indicate that their request was stale and that they&#x27;ll need to refresh again? 15s is pretty quick, but how do caching schemes work when users need to know when to use their time refreshing and checking the results. Alternatively, I&#x27;d be interested to read about the architecture of a modern always fresh caching scheme.