Recent posts from crabmusket.net
The headlines:
Keep reading for the full posts:
Somebody please clone Cloudflare Durable Objects
29 Nov 2024
I’ve been looking into how to build a Figma-like realtime multiplayer editor. These two articles go into a lot of detail about the efforts Figma had to expend to achieve it:
https://www.figma.com/blog/rust-in-production-at-figma/
https://www.figma.com/blog/how-figmas-multiplayer-technology-works/
While I was working on a series of prototypes based on the posts above, Cloudflare dropped a new product: Durable Objects, an extension of their Workers platform.
https://blog.cloudflare.com/introducing-workers-durable-objects/
As Paul puts it in this piece about the Durable Objects advantage:
Durable Objects provide a way to reliably connect two clients to the same object . Each object has a (string) name that is used when connecting to it, which typically corresponds to a “room” or “document ID” in the application itself.
In practice, this means that two clients can establish WebSocket connections using the same document ID, and the infrastructure will guarantee that they are connected to the same Durable Object instance.
This is the difference that makes Durable Objects so compelling for multiplayer use cases, but it’s also the reason that the Durable Object abstraction hasn’t been slapped on top of other FaaS platforms – it is a radical departure from core assumptions made by their scheduling and routing systems.
https://digest.browsertech.com/archive/browsertech-digest-cloudflares-durable/
The Durable Objects killer feature is the global uniqueness of each object, and the ability to address the object from a known string.
For example, say I have a “customer” object in my database and I want to associate a realtime session with each customer, e.g. for the purpose of adding realtime updates to the CRM interface for that customer.
A client can send a request to Cloudflare asking:
connect me via Websocket to the Object identified by
"session:customer_
"
and when two clients make that same request with the same
on opposite sides of the world, both their Websockets will end up connected to the same Durable Object instance
somewhere
in Cloudflare.
I’ve been wishing another cloud provider would build similar functionality, but as Paul notes, it’s not simple. While edge workers (especially JavaScript ones) are fairly commoditised now, building on Durable Objects is still significant vendor lock-in.
We are all very near despair
25 Nov 2024
The epigraph to Jane Jacobs’ The Death and Life of Great American Cities reads:
“We are all very near despair. The sheathing that floats us over its waves is compounded of hope, faith in the unexplainable worth and sure issue of effort, and the deep, sub-conscious content which comes from the exercise of our powers.”
– Oliver Wendell Holmes, Jr
I’m struck by how the swing from despair to contentment in the quote mirrors the journey of her book’s title, from death to life.
The quote resonates so much with me because of this fragment: “the unexplainable worth and sure issue of effort”.
I have a real sense that we humans are made to be creative, to strive, to exert our effort. We aren’t made for drudgery, for rote work or degrading toil. Our effort sustains us in a world that constantly challenges and threatens us. It is how we care for each other.
This innate creativity can be twisted - into hustle culture, into propsperity gospels, into class warfare that convinces the poor that they must overwork themselves to enrich the owners. But I, for my part, still feel most content when I have done hard work for a good cause.
I made this quote the epigraph for my own website because I want it to be a statement of intent, a reflection of what I value and why I write.
That's all folks! Thanks for reading ♥