4 ms·
(I wrote this.) > Also, instead of updating the `users` table with the LSN of the commit - which creates extra write load - why not store it in the session coo
by brandur 9y ago
(I wrote this.)
> Also, instead of updating the `users` table with the LSN of the commit - which creates extra write load - why not store it in the session cookie, then you can route based on that.
The article's a little long, but at one point I do mention that we're putting this information in Postgres in the demo for convenience, but that in a real implementation it might be worthwhile moving it elsewhere as an optimization.
This addresses the first point as well: you're right in that this information can be procured from Postgres, but the point of putting in the observer is to demonstrate a system that could be implemented in a way that's agnostic of storage. It's very plausible that you might want to put `min_lsn` and replication statuses in something very fast like Redis, and even have each `api` worker caching its own version of the latter so that a replica can be selected without even making a network call.
- Cieplak 9y agoHow do you generate your diagrams? They're really beautiful. Zooming in on the svg I see that it's all just unicode, but was wondering if you're manually typesetting it.
- lfittl 9y agoAFAIK its Monodraw: https://monodraw.helftone.com/ https://monodraw.helftone.com/ (I've asked Brandur this in the past, so assuming he hasn't changed it this should still be what he uses)
- CaliforniaKarl 9y agoOh, wow. My internal ikiwiki pages are filled with ASCII art diagrams. This tool looks awesome; I’ll have to try it out!
- goliatone 9y agoThere was another article from Brandur recently about redis streams- which was great. The diagrams really called my attention but I shied away from asking the source since it felt like a bit disrespectful. Thanks for the link.