All Products
Search
Document Center

Edge Security Acceleration:Edge KV

Last Updated:Sep 19, 2024

Points of presence (POPs) provide the edge storage service Edge KV, which is based on key-value pairs. After you write data to Edge KV, the data can be automatically synchronized to POPs around the world. Edge Routine can read and use the key-value pairs on the same POP. You can use Edge KV together with Edge Routine to deploy lightweight Blockchain as a Service (BaaS) services and API gateway services.

How it works

When you write key-value pairs in the Edge Security Acceleration (ESA) console or by calling an operation, the data is not directly written to POPs, but is written to the KV storage of the central POP. Within a short period of time after the data is stored in the central POP, ESA clears the corresponding dirty data in the KV storage of edge POPs to ensure the accuracy of data read.

When a client initiates a request, the key-value pair is read from the nearest POP. This speeds up data access. However, not all the data written to the central POP is immediately pushed to edge POPs for storage. Therefore, cache miss may occur for access to newly written data on edge POPs. In this case, ESA proactively reads the data from the central POP and caches it to edge POPs. Subsequent requests for the data will have cache hits on the edge POPs. This mechanism makes the first access to newly written data slower, but subsequent accesses faster.

Based on the preceding principle, Edge KV is suitable for scenarios in which data is infrequently written but frequently read and global consistency of stored data is required.

image

Terms

namespace

A namespace is a database that is used to manage key-value pairs, which has a globally unique name in your account. After you create a namespace, you can add key-value pairs to the namespace.

key-value pair

Each key-value pair belongs to a namespace. Before you read a key-value pair, you need to specify a namespace.

image

Limits

Limit

Description

Storage space

  • An Alibaba Cloud account can have up to 10 GB of storage space.

  • A namespace can have up to 1 GB of storage space.

Key-Value

  • A key can be up to 512 bytes in length and can contain only letters, digits, hyphens (-), and underscores (_). It cannot contain special characters, such as spaces, forward slashes (/), and question marks (?).

  • A value can be up to 1.8 MB in size.

    Note

    Each key-value pair belongs to a namespace.

Synchronization time

To ensure data consistency, data is synchronized to POPs around the world in 20 seconds in most cases and in 300 seconds in rare cases.

Access limit

ER can read and write only Edge KV data that belongs to the same Alibaba Cloud account. For example, Edge Routine of Account A cannot read and write Edge KV data of Account B.

Use Edge KV

After you activate Edge KV, you can use Edge KV in the ESA console or by calling the built-in API operations of Edge Routine.

image

Create a namespace

Note

Namespaces are isolated from each other. You can create up to 10 namespaces.

  1. Log on to the ESA console.

  2. In the left-side navigation pane, choose Edge Computing > EdgeKV. On the page that appears, click Create Namespace, and configure the Namespace Name and Description parameters.

    Note

    The Namespace Name parameter corresponds to the namespace parameter in the built-in API operations of Edge Routine.

    创建存储空间

  3. Click OK.

Manage Edge KV data by using the ESA console

Note

You can add a value of up to 100 KB in size in the ESA console. To add a value of a larger size, call an API operation.

You can add, modify, or delete Edge KV data in the ESA console.

  1. Log on to the ESA console.

  2. In the namespace list, find the namespace that you want to manage and click Manage in the Actions column.

  3. Click Add Key-Value Pair and follow the on-screen instructions to configure the Key and Value parameters.8

  4. Click OK.

  5. (Optional) After you add data, click Modify, View, or Delete to manage the data.

Manage Edge KV data by calling API operations

You can call the built-in API operations of Edge Routine to add, modify, query, or delete Edge KV data.

Important
  • Before you use API operations to manage data, make sure that a namespace is created in the ESA console.

  • For more information about API operations, see Edge KV API.

  1. Call Constructor to pass the namespace parameter to create a key-value object.

    The value of the namespace parameter is the name of the namespace that you created in the ESA console. You can view the namespace in the namespace list.

    const edgeKv = new EdgeKV({ namespace: "ns"});
  2. After you create a key-value object, call the following built-in API operations to implement the related features.

    API

    Description

    get

    Reads data from a namespace.

    delete

    Deletes a specific key and its value from a namespace.