It’s possible to create edge dictionaries for compute services, but local_server doesn’t include an option to make a dictionary for local development. Is there a way to run code that reads an edge dictionary locally and populate a dictionary with some values?
Hi @PaulRudin
Thanks for reaching out.
To answer your question
Edge Dictionaries are only supported on the VCL platform.
But there are other options available for the Compute@Edge platform.
Specifically, a KV Store sounds like what you require.
Details
Fastly provides access to both dynamic configuration data and also separate data stores.
See the links below for a reference:
For the Compute@Edge platform you’ll need to define either a local Config Store (which is read-only at the edge, but writable via the Fastly API) or a KV Store (which is both readable and writable at the edge).
For using a Config Store, you can find an example of how to do that here:
For using a KV Store, you can find an example of how to do that here:
Hope this helps.
If you have any other questions, then just let us know.
Thanks!
You can at them moment create edge dictionaries for compute services and your edge code can read values from those dictionaries. You’re saying that this is deprecated or not advisable?
For a couple of small keys that won’t change often, but will be read on every request is it preferable to use a kv store or a config store?
This code sample includes reading a dictionary from edge code: Override TTLs for path prefixes | Fastly Developer Hub
Hi @PaulRudin
You’re correct, Edge Dictionaries on the Compute@Edge platform are deprecated and in its place we recommend the use of a Config Store.
Thanks for the example link, I’ll create a ticket to get that updated to use the relevant Config Store methods exposed by the SDKs.
HISTORY NOTE: The Compute@Edge SDKs originally implemented support for a ‘read-only’ data store, which they (confusingly) named “Edge Dictionaries”. This feature was later renamed to “Config Store” and in later releases of the SDKs they showed as supporting both Edge Dictionaries and Config Stores when really the internal implementation was effectively the same.
Thanks for the explanation. Would you be able to expand on why a KV store is better than a config store for my use case please?
Hi @PaulRudin
Would you be able to expand on why a KV store is better than a config store for my use case please?
Sure thing!
Your original question mentioned…
Is there a way to run code that reads an edge dictionary locally and populate a dictionary with some values?
So I’ve interpreted this to mean: you require your edge app to be able to both READ and WRITE data at the edge (i.e. from within your Compute@Edge application).
For that use case a KV Store is the only option as it’s the only store that supports both READ and WRITE operations from the edge.
An edge application can READ the contents of a Config Store, but the app won’t be able to WRITE to the store. To action a WRITE operation to a Config Store you’d have to use the Fastly API (or the Fastly CLI, which itself still uses the Fastly API).
Hope that helps clarify my previous comments.
If I’ve misunderstood your requirements, then of course just let me know
EDIT: If your original question was suggesting that you need your edge app to READ content from a store so you can then populate an in-memory dictionary (aka map, hash table etc the terminology changes depending on the language you’re using) then a Config Store would be fine because you can READ initial values from it and then store those in your own data structure.
Yeah sorry, possibly ambiguous wording on my part. It sounds like a configStore will be fine.