What are the options we have for handling state as the edge? What do you use in your business or service?
Ask HN: Options for handling state at the edge?
1–10 of 40 posts
Re: Ask HN: Options for handling state at the edge?
#2Re: Ask HN: Options for handling state at the edge?
#3While it's possible to distribute state to many AWS regions and select the closest one, I ended up going a different route: packaging state alongside the application. Most of the application's state was read-only, so I ended up packaging the application state up as JSON alongside the deployment bundle. At startup, it'd then statically read the JSON into memory - this performance penalty only happens at startup, and as long as the Lambda functions are being called often (in our case they are), requests are as fast as a memory read.
When the state does need to get updated, I just redeploy the application with the new state.
That strategy obviously won't work if you need "fast" turnaround on your state being in sync at all points of presence, or if users can update that state as part of your application's workflow.
Re: Ask HN: Options for handling state at the edge?
#4If you want to go one step further you can build a VMOD for Varnish to run your workloads inside Varnish, even with Rust: https://github.com/gquintard/vmod_rs_template
Re: Ask HN: Options for handling state at the edge?
#5Have your process regularly update the CDB file from a blob store like S3. Any deltas can be pulled from S3 or you can use a message bus if the changes are small. Every so often pull the latest CDB down and start aggregating deltas again.
CDB performs great and can scale to multiple GBs.
Re: Ask HN: Options for handling state at the edge?
#6Now on to develop the actual application that will host/serve your data to said cache layer.
If you learn basic application architecture concepts, you won't be fooled by sales person lies again.
Re: Ask HN: Options for handling state at the edge?
#7I recently had an opportunity to build an application on top of Lambda@Edge (AWS's equivalent of Cloudflare workers). The prevailing wisdom there was to make use of regional services, like S3 and DynamoDB, from the edge. That, of course, makes my edge application depend on calls to a larger, further away point of presence. While it's possible to distribute state to many AWS regions and select the closest one, I ended…
Re: Ask HN: Options for handling state at the edge?
#8I have used card database files before with success. https://cr.yp.to/cdb.html Have your process regularly update the CDB file from a blob store like S3. Any deltas can be pulled from S3 or you can use a message bus if the changes are small. Every so often pull the latest CDB down and start aggregating deltas again. CDB performs great and can scale to multiple GBs.
Re: Ask HN: Options for handling state at the edge?
#9I recently had an opportunity to build an application on top of Lambda@Edge (AWS's equivalent of Cloudflare workers). The prevailing wisdom there was to make use of regional services, like S3 and DynamoDB, from the edge. That, of course, makes my edge application depend on calls to a larger, further away point of presence. While it's possible to distribute state to many AWS regions and select the closest one, I ended…
Re: Ask HN: Options for handling state at the edge?
#10Most data-formats are thick-formats, pack data into a single file. Part of the effort in switching to git would be a shift to trying to unpack our data, to really make use of the file system to store fine grained pieces of data.
It's been around for a while, but Irmin[1] (written in Ocaml) is a decent-enough almost-example of these kinds of practices. It lacks the version control aspect, but 9p is certainly another inspiration, as it encouraged state of all things to be held & stored in fine-grained files. Git I think is a superpower, but just as much: having data which can be scripted, which speaks the lingua-franca of computing- that too is a superpower.
[1] https://irmin.org/ https://news.ycombinator.com/item?id=8053687 (147 points, 8 years ago, 25 comments)