I am catching up on Ben's posts on web perf and I still don't quite get what happens when a post is edited. I understand that things are cached but doesn't that mean that if a post is edited it will take an unpredictable amount of time to update to CDNs all around the world? What are the best practices around this? Does it cost anything to do this? These are the kinds of questions I have when wondering about what I would run into if I were to make a dev.to clone.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (8)
Yes, but once it hits the CDN, everybody gets the new copy. It's a matter of knowing that there will be a high read-to-write ratio to justify the strategy. Any post will get many orders of magnitudes of reads for every write. Under some circumstances we also make use of "stale while revalidate" where users see the stale version until they see a fresh version. We don't do this on article pages where we owe it to the author to not show stale, but in some places it's perfectly fine.
But on top of that, requests that hit the origin aren't that slow.
I am hardly ever happy with my posts no matter how many times I read them, so I edit a lot. I frequently see cached copies of my posts. Even after I Ctrl-F5 to see the updated copy. When I go back to it thru notifications, I'll get the original copy again. (Mainly applies to comments, I think.) I always wondered which version others were seeing, but I assume it was the very first one.
I also notice that sometimes I see an edit link on my comments, and sometimes not.
I also see this a lot. In fact, just today I was thinking I should send in a bug report to Ben and the team. Thanks for calling this one out.
Thanks a lot. This was a case where I'm not surprised it happens but grossly misread the frequency. Knowing this will definitely help us prioritize this. A bug report detailing where exactly it happens would still be appreciated.
It happens pretty reliably like this:
Thanks for the heads up. I think there are some cases we are not properly handling. We'll get it worked out.
Yeah that's a known bug we're working on.
Thanks for feedback Kasey.
No worries man. Y'all do a great job. And after all:
thanks Ben! There are tradeoffs to make for sure. I think part of my hesitation is analysis paralysis. Having someone like you be transparent as to how you do things really helps (in case I need to do this in future)! thank you!