3 ms·
Or can we just cheat a little since the tolerance is much higher? Sure, we call this caching. Imagine you have a blog with comments. You can generate the pag
by jrockway 16y ago
Or can we just cheat a little since the tolerance is much higher?
Sure, we call this caching. Imagine you have a blog with comments. You can generate the page for each user when he wants it, and then it's a real view onto the data that you have available. Or, you can generate it once a second and just serve the stale version -- not much can happen in one second. Making that compromise is the difference between handling 10 requests a second and 10,000 requests a second. Almost always a good tradeoff.
(Doesn't NYTimes do this?)
- ElbertF 16y agoI've noticed this on Reddit. When you submit a comment it's inserted into the page with a bit of JavaScript but when you refresh the page it's gone. Refresh the page again after a few seconds and it's there.
- iamwil 16y agoMy point was that asking the question in the first place is good practice to avoid doing work you don't need to, rather than the actual specific examples I made up on the spot. But thanks for the example!