Utilizing DataStorage Use Limits

# Course Introduction

When using DataStorage, you need to check the space and credit limits and use it accordingly. Let's learn about DataStorage usage limits.

# DataStorage Storage Limit

The following is the DataStorage storage limits. The string value size is calculated as the number of bytes when converted to a byte array via UTF-8 encoding.

[{"Category":"DataStorage name","Storage Limit":"1 ~ 64 byte"},{"Category":"DataStorage key","Storage Limit":"1 ~ 100 byte"},{"Category":"DataStorage tag","Storage Limit":"0 ~ 64 byte"},{"Category":"DataStorage version","Storage Limit":"0 ~ 64 byte"},{"Category":"update","Storage Limit":"0 ~ 50,000 byte"},{"Category":"set","Storage Limit":"0 ~ 300,000 byte"}]

# Credit

Credit is a unit calculated to limit the number of database requests. The minimum value for Credit is 1. Credits are consumed only on actual requests to the database. FunctionGroups differ from each other in the number of Credits paid every minute, the number of Credits accumulated, and the number of Credits consumed on request by the database. To see which FunctionGroup belongs to each function, check out [Learn DataStorage Use Limits](/docs?postId=1044).

[{"FunctionGroup":"List DataStorage","Credits Paid per Minute":"10 + (Number of Connections * 2)","Max Credit That Can Be Accumulated":"Credits Paid per Minute * 2","Credits Consumed on Request":"1"},{"FunctionGroup":"Delete DataStorage","Credits Paid per Minute":"10 + (Number of Connections * 2)","Max Credit That Can Be Accumulated":"Credits Paid per Minute * 2","Credits Consumed on Request":"1"},{"FunctionGroup":"List Sorted","Credits Paid per Minute":"50 + (Number of Connections * 2)","Max Credit That Can Be Accumulated":"Credits Paid per Minute * 2","Credits Consumed on Request":"1"},{"FunctionGroup":"List","Credits Paid per Minute":"10 + (Number of Connections * 2)","Max Credit That Can Be Accumulated":"Credits Paid per Minute * 2","Credits Consumed on Request":"1"},{"FunctionGroup":"Delete","Credits Paid per Minute":"50 + (Number of online users * 2)","Max Credit That Can Be Accumulated":"Credits Paid per Minute * 2","Credits Consumed on Request":"1"},{"FunctionGroup":"Get","Credits Paid per Minute":"100 + (Number of Connections * 10)","Max Credit That Can Be Accumulated":"Credits Paid per Minute * 2","Credits Consumed on Request":"1 per 4,000 Bytes"},{"FunctionGroup":"Set","Credits Paid per Minute":"100 + (Online Players * 10)","Max Credit That Can Be Accumulated":"Credit Given per Minute * 2","Credits Consumed on Request":"1 per 4,000byte"}]

#### Credit Consumption Depending on Byte Size

1 Credit is used from 0 to 4000 Byte. Credit is also consumed when searching for values that don't exist. The size of string value is calculated as the number of bytes when converted to a byte array via UTF-8 encoding.

> Tip Key, tag and version sizes do not affect Credit.

#### Credit Consumption in Batch-Type Functions

Batch-type functions such as BatchGetAsync can access multiple keys at once. The number of Credits consumed by these functions depends on the number of keys on request. Even when two values are requested, the amount of Credit consumed changes based on the requested number of Bytes. For example, if a request had two values of 2,000 Bytes each, a total of 2 Credits will be consumed. Meanwhile, when the two values are 4,000 Bytes and 4,500 Bytes, the 4,000 Byte value will cosume 1 Credit and the 4,500 Byte value will consume 2 Credits. When using the batch-type functions, it's important to consider when Credits will be consumed. Credits are consumed at the time of actual request to the database. If you pass 50 keys to the `BatchGetAndWait()` function, it wouldn't consume Credit for the 50 values in a single call. The immediate call consumes Credit for 25 values, and the subsequent returning page consumes Credit for the remaining 25 values as it moves to the next page via `MoveToNextPageAndWait()`.

> Tip The `BatchSetAndWait()` function requests the number of keys directly passed.

#### Credit Consumption in Transact-Type Functions

Transaction-affiliated functions work similarly to batch-affiliated functions. However, more processing is required to guarantee a transaction, so it consumes double the Credit compared to batch affiliated functions.

#### Functions That Don't Consume Credit

When you used a function, but another function has already loaded a page, it doesn't consume Credit. For example, the `MoveToNextPageAndWait()` and `LoadNextPageAndWait()` functions do not consume Credit, depending on the situations. For example, when calling the `MoveToNextPageAndWait()` function after pre-loading the next Page of the GlobalDataStoragePages using `LoadNextPageAndWait()`, since the Page was already loaded, a request isn't made to the database. Therefore, Credit is only consumed when calling the `LoadNextPageAndWait()` function.