Data model design
Use these best practices when building your EdgeKV database.
You can also review the EdgeKV data model for more information about the what to consider when designing your database.
Identify the type of values you want to store
- What do you want to store?
- What size are your values?
- What is the lifetime of a value?
- What format do you want to use to store values: string or JSON?
The format of item values does not need to be uniform across the database, namespace, or group. You can mix and match formats as long as you know what format that was used to write each item. If you do not know what format was used to write the data, you can always retrieve it as a text string. Retrieving the value as JSON will validate that the data is in a valid JSON format, but will otherwise throw an exception.
Use namespaces sparingly
Namespaces are “scarce resources” in EdgeKV, and should be used sparingly. Groups are an unlimited resource in EdgeKV and may be used at your discretion to group content in meaningful ways.
Review the EdgeKV limitations
Consider how the EdgeKV Product limits may impact your design.
Review EdgeWorkers limitations
Consider how EdgeWorkers limitations on memory, execution time, and the supported number of allowed sub-requests per event handler type may impact your design. EdgeKV requests will also count towards the EdgeWorkers sub-request limits. For more information refer to the limitations section in the EdgeWorkers documentation.
Consider how your source data model fits into the EdgeKV data model
Keep in mind that the EdgeKV data model may be different than your existing data model. Consider how you will map those two models.
Consider the JSON nesting depth and data structure when storing data
The JSON structure of your database impacts how efficiently EdgeKV can execute requests and provide responses. To optimize the performance of your database use as simple a structure as possible.
Updated about 1 year ago