You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/v4/dynamic-configuration.md
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -266,6 +266,15 @@ Spin creates the path and file if they don't already exist.
266
266
267
267
> If, during development, you need to examine keys and values, you can open the file using `sqlite3` or another SQLite tools. However, the file format is subject to change, and you should not rely on it.
268
268
269
+
#### Limits and Requirements
270
+
271
+
* Key size: Up to 256 bytes (UTF-8 encoded)
272
+
* Value size: Up to 1 MB
273
+
* Capacity: 1024 key value tuples
274
+
* Reads per second: unlimited
275
+
* Writes per second: unlimited
276
+
* Global replication: none
277
+
269
278
### Redis Key Value Store Provider
270
279
271
280
To use a Redis store as a backend for Spin's key-value store, set the type to `redis` and provide the URL of the Redis host:
> Note: The CosmosDB container must be created with the default partition key, `/id`.
293
311
312
+
#### Limits and Requirements
313
+
314
+
* Key size: Up to 255 characters (Cosmos DB document id limit)
315
+
* Value size: Up to ~400 KB per item total (Cosmos DB hard limit; not validated in Spin code)
316
+
* Key syntax: Keys must NOT contain: /, \, ?, #
317
+
* Capacity: Unlimited
318
+
* Reads per second: Determined by provisioned RU/s on the Cosmos DB container
319
+
* Writes per second: Determined by provisioned RU/s on the Cosmos DB container
320
+
* Global replication: Yes (Cosmos DB supports multi-region replication)
321
+
294
322
### AWS DynamoDB Key Value Store Provider
295
323
296
324
To use an Amazon Web Services DynamoDB database as a backend for Spin's key-value store, set the type to `aws_dynamo` and specify your database account details:
@@ -309,6 +337,15 @@ By default, the DynamoDB backend uses eventually consistent reads. The `consiste
309
337
310
338
> Note: The DynamoDB table must be created with the partition key `PK`. It must have no sort key (so that the partition key is the primary key).
311
339
340
+
#### Limits and Requirements
341
+
342
+
* Key size: Up to 2048 bytes
343
+
* Value size: Up to 400 KB per item
344
+
* Capacity: Unlimited
345
+
* Reads per second: Determined by DynamoDB table capacity mode (provisioned or on-demand)
346
+
* Writes per second: Determined by DynamoDB table capacity mode
347
+
* Global replication: Depends on deployment
348
+
312
349
### Multiple and Non-Default Key-Value Stores
313
350
314
351
Whilst a single default store may be sufficient for certain application use cases, each Spin application can be configured to support multiple stores of any `type`, as shown in the `runtime-config.toml` file below:
Copy file name to clipboardExpand all lines: content/v4/kv-store-api-guide.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,13 +16,7 @@ Spin provides an interface for you to persist data in a key value store managed
16
16
17
17
## Using Key Value Store From Applications
18
18
19
-
The Spin SDK surfaces the Spin key value store interface to your language. The following characteristics are true of keys and values:
20
-
21
-
* Keys as large as 256 bytes (UTF-8 encoded)
22
-
* Values as large as 1 megabyte
23
-
* Capacity for 1024 key value tuples
24
-
25
-
The set of operations is common across all SDKs:
19
+
The Spin SDK surfaces the Spin key value store interface to your language. The set of operations is common across all SDKs:
26
20
27
21
| Operation | Parameters | Returns | Behavior |
28
22
|------------|------------|---------|----------|
@@ -201,6 +195,12 @@ func example() error {
201
195
202
196
{{ blockEnd }}
203
197
198
+
## Key Value Store Limits
199
+
200
+
The key/value size limits and syntactic requirements of a key value store depends on which [key value store provider](./dynamic-configuration#key-value-store-runtime-configuration) your app uses. The Spin command line currently supports a [default local SQLite provider]((./dynamic-configuration#file-key-value-store-provider)), a Redis KV provider, an Azure Cosmos DB backed provider, and an AWS Dynamo DB provider. See the [key value store runtime configuration](./dynamic-configuration#key-value-store-runtime-configuration) documentation for more information about the limits and requirements of each provider.
201
+
202
+
When you deploy your application, bear in mind that your deployment platform may have a KV provider with different characteristics from your local one!
203
+
204
204
## Custom Key Value Stores
205
205
206
206
Spin defines a key-value store named `"default"` and provides automatic backing storage. If you need to customize Spin with additional stores, or to change the backing storage for the default store, you can do so via the `--runtime-config-file` flag and the `runtime-config.toml` file. See [Key Value Store Runtime Configuration](./dynamic-configuration#key-value-store-runtime-configuration) for details.
0 commit comments