Points of presence (POPs) provide the edge storage service EdgeKV, which is based on key-value pairs. After you write data to EdgeKV, the data can be automatically synchronized to POPs around the world. EdgeRoutine (ER) can read and use the key-value pairs on the same POP. You can use EdgeKV together with ER to deploy lightweight Blockchain as a Service (BaaS) services and API gateway services.
Scenarios
EdgeKV is suitable for scenarios in which developers write data at low frequencies and ER reads data at high frequencies. For example, developers write data to EdgeKV in the Dynamic Content Delivery Network (DCDN) console. Then, the built-in API operations of ER are called to read data at high frequencies to process client requests.
Limits
Item | Description |
Storage space |
|
Key-Value |
|
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 EdgeKV data that belongs to the same Alibaba Cloud account. For example, ER in Account A cannot read and write EdgeKV data in Account B. |
Billing
Pricing
The prices for different operations are different. The following table describes the prices for different operations.
Billable item | Billing rule | Billing cycle | Unit price |
Key-value storage | You are charged based on the size and storage duration of the key-value pairs. | Pay-by-day: The amount that is due on each day is deducted from your account balance at 00:00 on the next day. | USD 0.0022 per GB-hour |
Key-value read (GET) | You are charged for the number of EdgeKV API requests that are initiated to read data from a namespace. For more information about GET requests, see GetDcdnKv. | USD 0.11 per 1 million calls | |
Key-value write (PUT) | You are charged for the number of EdgeKV API requests that are initiated to write or update data to a namespace. For more information about PUT requests, see PutDcdnKv. | USD 1 per 1 million calls | |
Key-value delete (DELETE) | You are charged for the number of EdgeKV API requests that are initiated to delete key-value pairs from a namespace. For more information about DELETE requests, see DeleteDcdnKv. | ||
Key-value list (LIST) | You are charged for the number of EdgeKV API requests that are initiated to list all keys in a namespace. For more information about LIST requests, see ListDcdnKv. |
EdgeKV is a value-added service. You are charged for namespaces and requests. Billable items such as number of routines, traffic, bandwidth, number of requests, and real-time logs, or value-added services are still billed based on your original billing methods. For more information about billing, see Billing overview.
Billing example
For example, you created Routine A, used 1 GB of the EdgeKV storage for 1 day, read key-value data from EdgeKV 2 million times, and wrote key-value data to EdgeKV 1 million times, as shown in the preceding figure.
Fee for EdgeKV on January 1, 2021: USD 0.0022 × 24 + USD 0.11 × 2,000,000 (reads) + USD 1 × 1,000,000 (writes) = USD 1.273.
The fee that was incurred on January 1, 2021 was deducted at 00:00:00 on January 2, 2021.
Activate EdgeKV
Before you can use EdgeKV, you need to activate EdgeKV.
Log on to the DCDN console.
In the left-side navigation pane, click EdgeKV, and then click Activate Now.
Use EdgeKV
After you activate EdgeKV, you can use EdgeKV by using the DCDN console or calling the built-in API operations of ER.
Create a namespace
Create a namespace in the DCDN console.
Namespaces are isolated from each other. You can create up to 10 namespaces.
Log on to the DCDN console.
In the left-side navigation pane, choose
. On the page that appears, click Create Namespace and follow the on-screen instructions to configure the Namespace Name and Description parameters.NoteThe Namespace Name parameter corresponds to the namespace parameter in the built-in API operations of ER.
Click OK.
Manage EdgeKV data by using the DCDN console
You can add, modify, or delete EdgeKV data in the DCDN console.
Log on to the DCDN console.
In the namespace list, find the namespace that you want to manage and click Manage in the Actions column.
Click Add Key-value and follow the on-screen instructions to configure the Key and Value parameters.
Click OK.
Optional. After you add data, click Modify, View, or Delete to manage the data.
Manage EdgeKV data by calling API operations
You can call the built-in API operations of ER to add, modify, query, or delete EdgeKV data.
Before you use API operations to manage data, make sure that a namespace is created in the DCDN console.
For more information about API operations, see EdgeKV API operations.
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 DCDN console. You can view the namespace in the namespace list.
const edgeKv = new EdgeKV({ namespace: "ns"});
After you create a key-value object, call the following built-in API operations to implement the related features.
API
Description
Reads data from a namespace.
Deletes a specific key and its value from a namespace.