Data model design

Use these best practices when building your EdgeKV database.

🚧

Warning!

EdgeKV is a distributed key-value store that enables JavaScript developers to build data-driven EdgeWorkers applications for latency-sensitive use cases. The current release of EdgeKV is not designed for handling personal, confidential, proprietary data, or any other type of data where unauthorized access to or disclosure of such data would result in loss, legal or regulatory liability, or other harm to Customers or their end users (“Sensitive Data”). EdgeKV should not, therefore, be used to store Sensitive Data. In addition, do not use data returned from EdgeKV to influence workflows that are in scope for compliance frameworks which mandate specific requirements for the handling of Sensitive Data without conducting an appropriate impact review. Customers of EdgeKV are responsible for maintaining control over the data loaded into EdgeKV and for review of applicable information security, privacy, and compliance requirements to determine the appropriateness of their use of this service.

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.


Did this page help you?