Read/Write Capacity Mode

Last updated: 2020-07-31 11:16:00

    Read/Write Capacity Mode Overview

    TcaplusDB uses the read/write capacity mode to calculate the volume of table read/write requests.

    Capacity unit (CU)

    It is the minimum request unit of resource access and the minimum statistical unit of requested data reads/writes.

    Read capacity unit (RCU)

    It is the minimum unit of read requests. The response data generated for a request may contain multiple RCUs. The maximum value of an RCU is 4 KB, i.e., an RCU indicates that a read request can be performed on a record that is up to 4 KB in size. If you need to read data of more than 4 KB, you need more RCUs.

    The base number of an RCU is 4 KB. The size of a request below 4 KB is calculated as 4 KB, and the size of a request above 4 KB is calculated as a multiple of 4 KB (the remaining part below 4 KB is calculated as 4 KB).
    Below is an example:
    Read request capacity
    You send a request to query a field in a record which is 10 KB in size, and the database returns the value of the specified field of the record. In this case, the response data is 10 KB, which is 3 RCUs.

    Write capacity unit (WCU)

    It is the minimum unit of write requests. The written data generated for a write request may contain multiple WCUs. The maximum value of a WCU is 4 KB, i.e., every 4 KB of written data will be counted as one WCU.
    The base number of a WCU is 4 KB. The size of a request below 4 KB is calculated as 4 KB, and the size of a request above 4 KB is calculated as a multiple of 4 KB (the remaining part below 4 KB is calculated as 4 KB).
    You can select whether to enable the result flag feature when performing a write operation. If it is enabled, the system will automatically calculate the returned CUs as WCUs.
    Consumed number of WCUs = CUs generated by data write + returned CUs

    Below is an example:

    • Write request
      You send a request to update content of 5 KB, and the backend reads the record (50 KB in total) containing the target data from the disk into the memory.
      Then, the backend updates the record and flushes the 50 KB content into the disk after the update.
      If you have enabled result flag, 5 KB content will be returned.
    • Result flag enabled
      13 CUs (50 KB data written into disk) + 2 CUs (5 KB returned data) = 15 WCUs generated
    • Result flag not enabled
      13 CUs (50 KB data written into disk) = 13 WCUs generated

    Preset mode

    If you select the preset mode, you need to adjust the preset read/write capacity of the table based on access change. This operation can help you control the TcaplusDB use to keep it at or below the defined request rate, so that you can predict the costs.
    To better configure the preset capacity, you need to estimate the application traffic in advance.

    Reserved read

    It refers to the RCU preconfiguration of a table. You need to estimate the highest RCU consumption per second of the table on the day and set the value as the reserved RCUs.

    Reserved write

    It refers to the WCU preconfiguration of a table. You need to estimate the highest WCU consumption per second of the table on the day and set the value as the reserved WCUs.

    Reserved capacity

    It refers to the preconfiguration of disk capacity usage of a table. You need to estimate the capacity used by the table on the day.

    Request limit and quota

    As your configured RCU or WCU value may be too low or the number of access requests may surge, TcaplusDB limits the requests exceeding 40% of the reserved RCUs or WCUs by default. This limit does not block the requests; instead, it makes the requests queue up to reduce the access frequency, which may cause timeout in the program. You can use the monitoring and alarming feature to know whether the current number of requests exceeds the preconfigured capacity.

    This limit can prevent your application from consuming too many CUs. However, if requests are limited, they will fail, and many system errors will occur.

    You can use TcaplusDB table monitoring to monitor the actual RCUs/WCUs and modify the table quota if necessary.