

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Memahami throughput hangat DynamoDB
<a name="warm-throughput"></a>

*Throughput hangat* mengacu pada jumlah operasi baca dan tulis yang dapat didukung oleh tabel DynamoDB Anda secara instan. Nilai-nilai ini tersedia secara default untuk semua tabel dan indeks sekunder global (GSI) dan mewakili seberapa besar skalanya berdasarkan penggunaan historis. Jika Anda menggunakan mode sesuai permintaan, atau jika Anda memperbarui throughput yang disediakan ke nilai-nilai ini, aplikasi Anda akan dapat mengeluarkan permintaan hingga nilai tersebut secara instan.

DynamoDB akan secara otomatis menyesuaikan nilai throughput hangat saat penggunaan Anda meningkat. Anda juga dapat meningkatkan nilai-nilai ini secara proaktif saat diperlukan, yang sangat berguna untuk acara puncak mendatang seperti peluncuran produk atau penjualan. Untuk acara puncak yang direncanakan, di mana tingkat permintaan ke tabel DynamoDB Anda mungkin meningkat 10x, 100x, atau lebih, Anda sekarang dapat menilai apakah throughput hangat saat ini cukup untuk menangani lalu lintas yang diharapkan. Jika tidak, Anda dapat meningkatkan nilai throughput hangat tanpa mengubah pengaturan throughput atau mode [penagihan](capacity-mode.md). Proses ini disebut sebagai *pra-pemanasan* tabel, memungkinkan Anda untuk menetapkan garis dasar yang dapat langsung didukung oleh tabel Anda. Ini memastikan aplikasi Anda dapat menangani tingkat permintaan yang lebih tinggi dari saat terjadi. Setelah meningkat, nilai throughput hangat tidak dapat dikurangi.

Anda dapat meningkatkan nilai throughput hangat untuk operasi baca, operasi tulis, atau keduanya. Anda dapat meningkatkan nilai ini untuk tabel Single-region baru dan yang sudah ada, tabel global, dan GSIs tabel. Untuk tabel global, fitur ini tersedia untuk [versi 2019.11.21 (Saat ini)](GlobalTables.md), dan pengaturan throughput hangat yang Anda atur akan secara otomatis berlaku untuk semua tabel replika di tabel global. Tidak ada batasan jumlah tabel DynamoDB yang dapat Anda lakukan sebelum pemanasan kapan saja. Waktu untuk menyelesaikan pra-pemanasan tergantung pada nilai yang Anda tetapkan dan ukuran tabel atau indeks. Anda dapat mengirimkan permintaan pra-hangat secara simultan dan permintaan ini tidak akan mengganggu operasi tabel apa pun. Anda dapat melakukan pra-pemanasan tabel hingga batas kuota tabel atau indeks untuk akun Anda di Wilayah tersebut. Gunakan [konsol Service Quotas](https://console.aws.amazon.com/servicequotas) untuk memeriksa batas Anda saat ini dan meningkatkannya jika diperlukan. 

Nilai throughput hangat tersedia secara default untuk semua tabel dan indeks sekunder tanpa biaya. Namun, jika Anda secara proaktif meningkatkan nilai throughput hangat default ini untuk pra-pemanasan tabel, Anda akan dikenakan biaya untuk permintaan tersebut. Untuk informasi selengkapnya, lihat harga [Amazon DynamoDB](https://aws.amazon.com/dynamodb/pricing/).

Untuk informasi lebih lanjut tentang throughput hangat, lihat topik di bawah ini:

**Topics**
+ [Periksa throughput hangat tabel DynamoDB Anda saat ini](check-warm-throughput.md)
+ [Tingkatkan throughput hangat tabel DynamoDB Anda yang ada](update-warm-throughput.md)
+ [Buat tabel DynamoDB baru dengan throughput hangat yang lebih tinggi](create-table-warm-throughput.md)
+ [Memahami throughput hangat DynamoDB dalam skenario yang berbeda](warm-throughput-scenarios.md)

# Periksa throughput hangat tabel DynamoDB Anda saat ini
<a name="check-warm-throughput"></a>

Gunakan petunjuk berikut AWS CLI dan AWS Konsol untuk memeriksa tabel atau nilai throughput hangat indeks Anda saat ini.

## Konsol Manajemen AWS
<a name="warm-throughput-check-console"></a>

Untuk memeriksa throughput hangat tabel DynamoDB Anda menggunakan konsol DynamoDB:

1. Masuk ke Konsol Manajemen AWS dan buka konsol DynamoDB di. [https://console.aws.amazon.com/dynamodb/](https://console.aws.amazon.com/dynamodb/)

1. Di panel navigasi kiri, pilih Tabel.

1. Pada halaman **Tabel**, pilih tabel yang Anda inginkan.

1. Pilih **Pengaturan tambahan** untuk melihat nilai throughput hangat Anda saat ini. Nilai ini ditampilkan sebagai satuan baca per detik dan satuan tulis per detik.

## AWS CLI
<a name="warm-throughput-check-CLI"></a>

 AWS CLI Contoh berikut menunjukkan cara memeriksa throughput hangat tabel DynamoDB Anda.

1. Jalankan `describe-table` operasi pada tabel DynamoDB Anda.

   ```
   aws dynamodb describe-table --table-name GameScores
   ```

1. Anda akan menerima respons yang mirip dengan yang di bawah ini. `WarmThroughput`Pengaturan Anda akan ditampilkan sebagai `ReadUnitsPerSecond` dan`WriteUnitsPerSecond`. Itu `Status` akan terjadi `UPDATING` ketika nilai throughput hangat sedang diperbarui, dan `ACTIVE` ketika nilai throughput hangat baru ditetapkan.

   ```
   {
       "Table": {
           "AttributeDefinitions": [
               {
                   "AttributeName": "GameTitle",
                   "AttributeType": "S"
               },
               {
                   "AttributeName": "TopScore",
                   "AttributeType": "N"
               },
               {
                   "AttributeName": "UserId",
                   "AttributeType": "S"
               }
           ],
           "TableName": "GameScores",
           "KeySchema": [
               {
                   "AttributeName": "UserId",
                   "KeyType": "HASH"
               },
               {
                   "AttributeName": "GameTitle",
                   "KeyType": "RANGE"
               }
           ],
           "TableStatus": "ACTIVE",
           "CreationDateTime": 1726128388.729,
           "ProvisionedThroughput": {
               "NumberOfDecreasesToday": 0,
               "ReadCapacityUnits": 0,
               "WriteCapacityUnits": 0
           },
           "TableSizeBytes": 0,
           "ItemCount": 0,
           "TableArn": "arn:aws:dynamodb:us-east-1:XXXXXXXXXXXX:table/GameScores",
           "TableId": "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
           "BillingModeSummary": {
               "BillingMode": "PAY_PER_REQUEST",
               "LastUpdateToPayPerRequestDateTime": 1726128388.729
           },
           "GlobalSecondaryIndexes": [
               {
                   "IndexName": "GameTitleIndex",
                   "KeySchema": [
                       {
                           "AttributeName": "GameTitle",
                           "KeyType": "HASH"
                       },
                       {
                           "AttributeName": "TopScore",
                           "KeyType": "RANGE"
                       }
                   ],
                   "Projection": {
                       "ProjectionType": "INCLUDE",
                       "NonKeyAttributes": [
                           "UserId"
                       ]
                   },
                   "IndexStatus": "ACTIVE",
                   "ProvisionedThroughput": {
                       "NumberOfDecreasesToday": 0,
                       "ReadCapacityUnits": 0,
                       "WriteCapacityUnits": 0
                   },
                   "IndexSizeBytes": 0,
                   "ItemCount": 0,
                   "IndexArn": "arn:aws:dynamodb:us-east-1:XXXXXXXXXXXX:table/GameScores/index/GameTitleIndex",
                   "WarmThroughput": {
                       "ReadUnitsPerSecond": 12000,
                       "WriteUnitsPerSecond": 4000,
                       "Status": "ACTIVE"
                   }
               }
           ],
           "DeletionProtectionEnabled": false,
           "WarmThroughput": {
               "ReadUnitsPerSecond": 12000,
               "WriteUnitsPerSecond": 4000,
               "Status": "ACTIVE"
           }
       }
   }
   ```

# Tingkatkan throughput hangat tabel DynamoDB Anda yang ada
<a name="update-warm-throughput"></a>

Setelah Anda memeriksa nilai throughput hangat tabel DynamoDB saat ini, Anda dapat memperbaruinya dengan langkah-langkah berikut:

## Konsol Manajemen AWS
<a name="warm-throughput-update-console"></a>

Untuk memeriksa nilai throughput hangat tabel DynamoDB Anda menggunakan konsol DynamoDB:

1. Masuk ke Konsol Manajemen AWS dan buka konsol DynamoDB di. [https://console.aws.amazon.com/dynamodb/](https://console.aws.amazon.com/dynamodb/)

1. Di panel navigasi kiri, pilih Tabel.

1. Pada halaman **Tabel**, pilih tabel yang Anda inginkan.

1. Di bidang **Hangat throughput**, pilih **Edit**.

1. Pada halaman **Edit throughput hangat**, pilih **Tingkatkan throughput hangat**.

1. Sesuaikan **unit baca per detik** dan **tulis satuan per detik**. Kedua pengaturan ini menentukan throughput yang dapat langsung ditangani tabel Anda.

1. Pilih **Simpan**.

1. **Unit baca Anda per detik** dan **unit tulis per detik** akan diperbarui di bidang **throughput hangat** saat permintaan selesai diproses.
**catatan**  
Memperbarui nilai throughput hangat Anda adalah tugas asinkron. `Status`Akan berubah dari `UPDATING` `ACTIVE` saat pembaruan selesai.

## AWS CLI
<a name="warm-throughput-update-CLI"></a>

 AWS CLI Contoh berikut menunjukkan cara memperbarui nilai throughput hangat tabel DynamoDB Anda.

1. Jalankan `update-table` operasi pada tabel DynamoDB Anda.

   ```
   aws dynamodb update-table \
       --table-name GameScores \
       --warm-throughput ReadUnitsPerSecond=12345,WriteUnitsPerSecond=4567 \
       --global-secondary-index-updates \
           "[
               {
                   \"Update\": {
                       \"IndexName\": \"GameTitleIndex\",
                       \"WarmThroughput\": {
                           \"ReadUnitsPerSecond\": 88,
                           \"WriteUnitsPerSecond\": 77
                       }
                   }
               }
           ]" \
       --region us-east-1
   ```

1. Anda akan menerima respons yang mirip dengan yang di bawah ini. `WarmThroughput`Pengaturan Anda akan ditampilkan sebagai `ReadUnitsPerSecond` dan`WriteUnitsPerSecond`. Itu `Status` akan terjadi `UPDATING` ketika nilai throughput hangat sedang diperbarui, dan `ACTIVE` ketika nilai throughput hangat baru ditetapkan.

   ```
   {
       "TableDescription": {
           "AttributeDefinitions": [
               {
                   "AttributeName": "GameTitle",
                   "AttributeType": "S"
               },
               {
                   "AttributeName": "TopScore",
                   "AttributeType": "N"
               },
               {
                   "AttributeName": "UserId",
                   "AttributeType": "S"
               }
           ],
           "TableName": "GameScores",
           "KeySchema": [
               {
                   "AttributeName": "UserId",
                   "KeyType": "HASH"
               },
               {
                   "AttributeName": "GameTitle",
                   "KeyType": "RANGE"
               }
           ],
           "TableStatus": "ACTIVE",
           "CreationDateTime": 1730242189.965,
           "ProvisionedThroughput": {
               "NumberOfDecreasesToday": 0,
               "ReadCapacityUnits": 20,
               "WriteCapacityUnits": 10
           },
           "TableSizeBytes": 0,
           "ItemCount": 0,
           "TableArn": "arn:aws:dynamodb:us-east-1:XXXXXXXXXXXX:table/GameScores",
           "TableId": "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
           "GlobalSecondaryIndexes": [
               {
                   "IndexName": "GameTitleIndex",
                   "KeySchema": [
                       {
                           "AttributeName": "GameTitle",
                           "KeyType": "HASH"
                       },
                       {
                           "AttributeName": "TopScore",
                           "KeyType": "RANGE"
                       }
                   ],
                   "Projection": {
                       "ProjectionType": "INCLUDE",
                       "NonKeyAttributes": [
                           "UserId"
                       ]
                   },
                   "IndexStatus": "ACTIVE",
                   "ProvisionedThroughput": {
                       "NumberOfDecreasesToday": 0,
                       "ReadCapacityUnits": 50,
                       "WriteCapacityUnits": 25
                   },
                   "IndexSizeBytes": 0,
                   "ItemCount": 0,
                   "IndexArn": "arn:aws:dynamodb:us-east-1:XXXXXXXXXXXX:table/GameScores/index/GameTitleIndex",
                   "WarmThroughput": {
                       "ReadUnitsPerSecond": 50,
                       "WriteUnitsPerSecond": 25,
                       "Status": "UPDATING"
                   }
               }
           ],
           "DeletionProtectionEnabled": false,
           "WarmThroughput": {
               "ReadUnitsPerSecond": 12300,
               "WriteUnitsPerSecond": 4500,
               "Status": "UPDATING"
           }
       }
   }
   ```

## AWS SDK
<a name="warm-throughput-update-SDK"></a>

Contoh SDK berikut menunjukkan cara memperbarui nilai throughput hangat tabel DynamoDB Anda.

------
#### [ Java ]

```
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.model.DynamoDbException;
import software.amazon.awssdk.services.dynamodb.model.GlobalSecondaryIndexUpdate;
import software.amazon.awssdk.services.dynamodb.model.UpdateGlobalSecondaryIndexAction;
import software.amazon.awssdk.services.dynamodb.model.UpdateTableRequest;
import software.amazon.awssdk.services.dynamodb.model.WarmThroughput;

...
public static WarmThroughput buildWarmThroughput(final Long readUnitsPerSecond,
                                                 final Long writeUnitsPerSecond) {
    return WarmThroughput.builder()
            .readUnitsPerSecond(readUnitsPerSecond)
            .writeUnitsPerSecond(writeUnitsPerSecond)
            .build();
}

public static void updateDynamoDBTable(DynamoDbClient ddb,
                                       String tableName,
                                       Long tableReadUnitsPerSecond,
                                       Long tableWriteUnitsPerSecond,
                                       String globalSecondaryIndexName,
                                       Long globalSecondaryIndexReadUnitsPerSecond,
                                       Long globalSecondaryIndexWriteUnitsPerSecond) {

    final WarmThroughput tableWarmThroughput = buildWarmThroughput(tableReadUnitsPerSecond, tableWriteUnitsPerSecond);
    final WarmThroughput gsiWarmThroughput = buildWarmThroughput(globalSecondaryIndexReadUnitsPerSecond, globalSecondaryIndexWriteUnitsPerSecond);

    final GlobalSecondaryIndexUpdate globalSecondaryIndexUpdate = GlobalSecondaryIndexUpdate.builder()
            .update(UpdateGlobalSecondaryIndexAction.builder()
                    .indexName(globalSecondaryIndexName)
                    .warmThroughput(gsiWarmThroughput)
                    .build()
            ).build();

    final UpdateTableRequest request = UpdateTableRequest.builder()
            .tableName(tableName)
            .globalSecondaryIndexUpdates(globalSecondaryIndexUpdate)
            .warmThroughput(tableWarmThroughput)
            .build();

    try {
        ddb.updateTable(request);
    } catch (DynamoDbException e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }

    System.out.println("Done!");
}
```

------
#### [ Python ]

```
from boto3 import resource
from botocore.exceptions import ClientError

def update_dynamodb_table_warm_throughput(table_name, table_read_units, table_write_units, gsi_name, gsi_read_units, gsi_write_units, region_name="us-east-1"):
    """
    Updates the warm throughput of a DynamoDB table and a global secondary index.

    :param table_name: The name of the table to update.
    :param table_read_units: The new read units per second for the table's warm throughput.
    :param table_write_units: The new write units per second for the table's warm throughput.
    :param gsi_name: The name of the global secondary index to update.
    :param gsi_read_units: The new read units per second for the GSI's warm throughput.
    :param gsi_write_units: The new write units per second for the GSI's warm throughput.
    :param region_name: The AWS Region name to target. defaults to us-east-1
    """
    try:
        ddb = resource('dynamodb', region_name)
        
        # Update the table's warm throughput
        table_warm_throughput = {
            "ReadUnitsPerSecond": table_read_units,
            "WriteUnitsPerSecond": table_write_units
        }

        # Update the global secondary index's warm throughput
        gsi_warm_throughput = {
            "ReadUnitsPerSecond": gsi_read_units,
            "WriteUnitsPerSecond": gsi_write_units
        }

        # Construct the global secondary index update
        global_secondary_index_update = [
            {
                "Update": {
                    "IndexName": gsi_name,
                    "WarmThroughput": gsi_warm_throughput
                }
            }
        ]

        # Construct the update table request
        update_table_request = {
            "TableName": table_name,
            "GlobalSecondaryIndexUpdates": global_secondary_index_update,
            "WarmThroughput": table_warm_throughput
        }

        # Update the table
        ddb.update_table(**update_table_request)
        print("Table updated successfully!")
    except ClientError as e:
        print(f"Error updating table: {e}")
        raise e
```

------
#### [ Javascript ]

```
import { DynamoDBClient, UpdateTableCommand } from "@aws-sdk/client-dynamodb";

async function updateDynamoDBTableWarmThroughput(
  tableName,
  tableReadUnits,
  tableWriteUnits,
  gsiName,
  gsiReadUnits,
  gsiWriteUnits,
  region = "us-east-1"
) {
  try {
    const ddbClient = new DynamoDBClient({ region: region });

    // Construct the update table request
    const updateTableRequest = {
      TableName: tableName,
      GlobalSecondaryIndexUpdates: [
        {
            Update: {
                IndexName: gsiName,
                WarmThroughput: {
                    ReadUnitsPerSecond: gsiReadUnits,
                    WriteUnitsPerSecond: gsiWriteUnits,
                },
            },
        },
      ],
      WarmThroughput: {
          ReadUnitsPerSecond: tableReadUnits,
          WriteUnitsPerSecond: tableWriteUnits,
      },
    };

    const command = new UpdateTableCommand(updateTableRequest);
    const response = await ddbClient.send(command);
    console.log(`Table updated successfully! Response: ${response}`);
  } catch (error) {
    console.error(`Error updating table: ${error}`);
    throw error;
  }
}
```

------

# Buat tabel DynamoDB baru dengan throughput hangat yang lebih tinggi
<a name="create-table-warm-throughput"></a>

Anda dapat menyesuaikan nilai throughput hangat saat membuat tabel DynamoDB dengan mengikuti langkah-langkah di bawah ini. Langkah-langkah ini juga berlaku saat membuat [tabel global](GlobalTables.md) atau [indeks sekunder](SecondaryIndexes.md).

## Konsol Manajemen AWS
<a name="warm-throughput-create-console"></a>

Untuk membuat tabel DynamoDB dan menyesuaikan nilai throughput hangat melalui konsol:

1. Masuk ke Konsol Manajemen AWS dan buka konsol DynamoDB di. [https://console.aws.amazon.com/dynamodb/](https://console.aws.amazon.com/dynamodb/)

1. Pilih **Buat tabel**.

1. Pilih **nama Table**, **Partition key**, dan **Sort key (opsional)**.

1. Untuk **pengaturan Tabel**, pilih **Sesuaikan pengaturan**.

1. Di bidang **throughput hangat**, pilih **Tingkatkan throughput hangat**.

1. Sesuaikan **unit baca per detik** dan **tulis satuan per detik**. Kedua pengaturan ini menentukan throughput maksimum yang dapat ditangani oleh tabel Anda secara instan.

1. Lanjutkan menambahkan detail tabel yang tersisa dan kemudian pilih **Buat tabel**.

## AWS CLI
<a name="warm-throughput-create-CLI"></a>

 AWS CLI Contoh berikut menunjukkan cara membuat tabel DynamoDB dengan nilai throughput hangat yang disesuaikan.

1. Jalankan `create-table` operasi untuk membuat tabel DynamoDB berikut.

   ```
   aws dynamodb create-table \
       --table-name GameScores \
       --attribute-definitions AttributeName=UserId,AttributeType=S \
                               AttributeName=GameTitle,AttributeType=S \
                               AttributeName=TopScore,AttributeType=N  \
       --key-schema AttributeName=UserId,KeyType=HASH \
                    AttributeName=GameTitle,KeyType=RANGE \
       --provisioned-throughput ReadCapacityUnits=20,WriteCapacityUnits=10 \
       --global-secondary-indexes \
           "[
               {
                   \"IndexName\": \"GameTitleIndex\",
                   \"KeySchema\": [{\"AttributeName\":\"GameTitle\",\"KeyType\":\"HASH\"},
                                   {\"AttributeName\":\"TopScore\",\"KeyType\":\"RANGE\"}],
                   \"Projection\":{
                       \"ProjectionType\":\"INCLUDE\",
                       \"NonKeyAttributes\":[\"UserId\"]
                   },
                   \"ProvisionedThroughput\": {
                       \"ReadCapacityUnits\": 50,
                       \"WriteCapacityUnits\": 25
                   },\"WarmThroughput\": {
                       \"ReadUnitsPerSecond\": 1987,
                       \"WriteUnitsPerSecond\": 543
                   }
               }
           ]" \
       --warm-throughput ReadUnitsPerSecond=12345,WriteUnitsPerSecond=4567 \
       --region us-east-1
   ```

1. Anda akan menerima respons yang mirip dengan yang di bawah ini. `WarmThroughput`Pengaturan Anda akan ditampilkan sebagai `ReadUnitsPerSecond` dan`WriteUnitsPerSecond`. Itu `Status` akan terjadi `UPDATING` ketika nilai throughput hangat sedang diperbarui, dan `ACTIVE` ketika nilai throughput hangat baru ditetapkan.

   ```
   {
       "TableDescription": {
           "AttributeDefinitions": [
               {
                   "AttributeName": "GameTitle",
                   "AttributeType": "S"
               },
               {
                   "AttributeName": "TopScore",
                   "AttributeType": "N"
               },
               {
                   "AttributeName": "UserId",
                   "AttributeType": "S"
               }
           ],
           "TableName": "GameScores",
           "KeySchema": [
               {
                   "AttributeName": "UserId",
                   "KeyType": "HASH"
               },
               {
                   "AttributeName": "GameTitle",
                   "KeyType": "RANGE"
               }
           ],
           "TableStatus": "CREATING",
           "CreationDateTime": 1730241788.779,
           "ProvisionedThroughput": {
               "NumberOfDecreasesToday": 0,
               "ReadCapacityUnits": 20,
               "WriteCapacityUnits": 10
           },
           "TableSizeBytes": 0,
           "ItemCount": 0,
           "TableArn": "arn:aws:dynamodb:us-east-1:XXXXXXXXXXXX:table/GameScores",
           "TableId": "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
           "GlobalSecondaryIndexes": [
               {
                   "IndexName": "GameTitleIndex",
                   "KeySchema": [
                       {
                           "AttributeName": "GameTitle",
                           "KeyType": "HASH"
                       },
                       {
                           "AttributeName": "TopScore",
                           "KeyType": "RANGE"
                       }
                   ],
                   "Projection": {
                       "ProjectionType": "INCLUDE",
                       "NonKeyAttributes": [
                           "UserId"
                       ]
                   },
                   "IndexStatus": "CREATING",
                   "ProvisionedThroughput": {
                       "NumberOfDecreasesToday": 0,
                       "ReadCapacityUnits": 50,
                       "WriteCapacityUnits": 25
                   },
                   "IndexSizeBytes": 0,
                   "ItemCount": 0,
                   "IndexArn": "arn:aws:dynamodb:us-east-1:XXXXXXXXXXXX:table/GameScores/index/GameTitleIndex",
                   "WarmThroughput": {
                       "ReadUnitsPerSecond": 1987,
                       "WriteUnitsPerSecond": 543,
                       "Status": "UPDATING"
                   }
               }
           ],
           "DeletionProtectionEnabled": false,
           "WarmThroughput": {
               "ReadUnitsPerSecond": 12345,
               "WriteUnitsPerSecond": 4567,
               "Status": "UPDATING"
           }
       }
   }
   ```

## AWS SDK
<a name="warm-throughput-create-SDK"></a>

Contoh SDK berikut menunjukkan cara membuat tabel DynamoDB dengan nilai throughput hangat yang disesuaikan.

------
#### [ Java ]

```
import software.amazon.awscdk.services.dynamodb.ProjectionType;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.model.CreateTableResponse;
import software.amazon.awssdk.services.dynamodb.model.CreateTableRequest;
import software.amazon.awssdk.services.dynamodb.model.KeySchemaElement;
import software.amazon.awssdk.services.dynamodb.model.KeyType;
import software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput;
import software.amazon.awssdk.services.dynamodb.model.Projection;
import software.amazon.awssdk.services.dynamodb.model.GlobalSecondaryIndex;
import software.amazon.awssdk.services.dynamodb.model.AttributeDefinition;
import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import software.amazon.awssdk.services.dynamodb.model.WarmThroughput;
...

public static WarmThroughput buildWarmThroughput(final Long readUnitsPerSecond,
                                                 final Long writeUnitsPerSecond) {
    return WarmThroughput.builder()
            .readUnitsPerSecond(readUnitsPerSecond)
            .writeUnitsPerSecond(writeUnitsPerSecond)
            .build();
}
private static AttributeDefinition buildAttributeDefinition(final String attributeName, 
                                                            final ScalarAttributeType scalarAttributeType) {
    return AttributeDefinition.builder()
            .attributeName(attributeName)
            .attributeType(scalarAttributeType)
            .build();
}
private static KeySchemaElement buildKeySchemaElement(final String attributeName, 
                                                      final KeyType keyType) {
    return KeySchemaElement.builder()
            .attributeName(attributeName)
            .keyType(keyType)
            .build();
}
public static void createDynamoDBTable(DynamoDbClient ddb,
                                       String tableName,
                                       String partitionKey,
                                       String sortKey,
                                       String miscellaneousKeyAttribute,
                                       String nonKeyAttribute,
                                       Long tableReadCapacityUnits,
                                       Long tableWriteCapacityUnits,
                                       Long tableWarmReadUnitsPerSecond,
                                       Long tableWarmWriteUnitsPerSecond,
                                       String globalSecondaryIndexName,
                                       Long globalSecondaryIndexReadCapacityUnits,
                                       Long globalSecondaryIndexWriteCapacityUnits,
                                       Long globalSecondaryIndexWarmReadUnitsPerSecond,
                                       Long globalSecondaryIndexWarmWriteUnitsPerSecond) {

    // Define the table attributes
    final AttributeDefinition partitionKeyAttribute = buildAttributeDefinition(partitionKey, ScalarAttributeType.S);
    final AttributeDefinition sortKeyAttribute = buildAttributeDefinition(sortKey, ScalarAttributeType.S);
    final AttributeDefinition miscellaneousKeyAttributeDefinition = buildAttributeDefinition(miscellaneousKeyAttribute, ScalarAttributeType.N);
    final AttributeDefinition[] attributeDefinitions = {partitionKeyAttribute, sortKeyAttribute, miscellaneousKeyAttributeDefinition};

    // Define the table key schema
    final KeySchemaElement partitionKeyElement = buildKeySchemaElement(partitionKey, KeyType.HASH);
    final KeySchemaElement sortKeyElement = buildKeySchemaElement(sortKey, KeyType.RANGE);
    final KeySchemaElement[] keySchema = {partitionKeyElement, sortKeyElement};

    // Define the provisioned throughput for the table
    final ProvisionedThroughput provisionedThroughput = ProvisionedThroughput.builder()
            .readCapacityUnits(tableReadCapacityUnits)
            .writeCapacityUnits(tableWriteCapacityUnits)
            .build();

    // Define the Global Secondary Index (GSI)
    final KeySchemaElement globalSecondaryIndexPartitionKeyElement = buildKeySchemaElement(sortKey, KeyType.HASH);
    final KeySchemaElement globalSecondaryIndexSortKeyElement = buildKeySchemaElement(miscellaneousKeyAttribute, KeyType.RANGE);
    final KeySchemaElement[] gsiKeySchema = {globalSecondaryIndexPartitionKeyElement, globalSecondaryIndexSortKeyElement};

    final Projection gsiProjection = Projection.builder()
            .projectionType(String.valueOf(ProjectionType.INCLUDE))
            .nonKeyAttributes(nonKeyAttribute)
            .build();
    final ProvisionedThroughput gsiProvisionedThroughput = ProvisionedThroughput.builder()
            .readCapacityUnits(globalSecondaryIndexReadCapacityUnits)
            .writeCapacityUnits(globalSecondaryIndexWriteCapacityUnits)
            .build();
    // Define the warm throughput for the Global Secondary Index (GSI)
    final WarmThroughput gsiWarmThroughput = buildWarmThroughput(globalSecondaryIndexWarmReadUnitsPerSecond, globalSecondaryIndexWarmWriteUnitsPerSecond);
    final GlobalSecondaryIndex globalSecondaryIndex = GlobalSecondaryIndex.builder()
            .indexName(globalSecondaryIndexName)
            .keySchema(gsiKeySchema)
            .projection(gsiProjection)
            .provisionedThroughput(gsiProvisionedThroughput)
            .warmThroughput(gsiWarmThroughput)
            .build();

    // Define the warm throughput for the table
    final WarmThroughput tableWarmThroughput = buildWarmThroughput(tableWarmReadUnitsPerSecond, tableWarmWriteUnitsPerSecond);

    final CreateTableRequest request = CreateTableRequest.builder()
            .tableName(tableName)
            .attributeDefinitions(attributeDefinitions)
            .keySchema(keySchema)
            .provisionedThroughput(provisionedThroughput)
            .globalSecondaryIndexes(globalSecondaryIndex)
            .warmThroughput(tableWarmThroughput)
            .build();

    CreateTableResponse response = ddb.createTable(request);
    System.out.println(response);
}
```

------
#### [ Python ]

```
from boto3 import resource
from botocore.exceptions import ClientError

def create_dynamodb_table_warm_throughput(table_name, partition_key, sort_key, misc_key_attr, non_key_attr, table_provisioned_read_units, table_provisioned_write_units, table_warm_reads, table_warm_writes, gsi_name, gsi_provisioned_read_units, gsi_provisioned_write_units, gsi_warm_reads, gsi_warm_writes, region_name="us-east-1"):
    """
    Creates a DynamoDB table with a warm throughput setting configured.

    :param table_name: The name of the table to be created.
    :param partition_key: The partition key for the table being created.
    :param sort_key: The sort key for the table being created.
    :param misc_key_attr: A miscellaneous key attribute for the table being created.
    :param non_key_attr: A non-key attribute for the table being created.
    :param table_provisioned_read_units: The newly created table's provisioned read capacity units.
    :param table_provisioned_write_units: The newly created table's provisioned write capacity units.
    :param table_warm_reads: The read units per second setting for the table's warm throughput.
    :param table_warm_writes: The write units per second setting for the table's warm throughput.
    :param gsi_name: The name of the Global Secondary Index (GSI) to be created on the table.
    :param gsi_provisioned_read_units: The configured Global Secondary Index (GSI) provisioned read capacity units.
    :param gsi_provisioned_write_units: The configured Global Secondary Index (GSI) provisioned write capacity units.
    :param gsi_warm_reads: The read units per second setting for the Global Secondary Index (GSI)'s warm throughput.
    :param gsi_warm_writes: The write units per second setting for the Global Secondary Index (GSI)'s warm throughput.
    :param region_name: The AWS Region name to target. defaults to us-east-1
    """
    try:
        ddb = resource('dynamodb', region_name)
        
        # Define the table attributes
        attribute_definitions = [
            { "AttributeName": partition_key, "AttributeType": "S" },
            { "AttributeName": sort_key, "AttributeType": "S" },
            { "AttributeName": misc_key_attr, "AttributeType": "N" }
        ]
        
        # Define the table key schema
        key_schema = [
            { "AttributeName": partition_key, "KeyType": "HASH" },
            { "AttributeName": sort_key, "KeyType": "RANGE" }
        ]
        
        # Define the provisioned throughput for the table
        provisioned_throughput = {
            "ReadCapacityUnits": table_provisioned_read_units,
            "WriteCapacityUnits": table_provisioned_write_units
        }
        
        # Define the global secondary index
        gsi_key_schema = [
            { "AttributeName": sort_key, "KeyType": "HASH" },
            { "AttributeName": misc_key_attr, "KeyType": "RANGE" }
        ]
        gsi_projection = {
            "ProjectionType": "INCLUDE",
            "NonKeyAttributes": [non_key_attr]
        }
        gsi_provisioned_throughput = {
            "ReadCapacityUnits": gsi_provisioned_read_units,
            "WriteCapacityUnits": gsi_provisioned_write_units
        }
        gsi_warm_throughput = {
            "ReadUnitsPerSecond": gsi_warm_reads,
            "WriteUnitsPerSecond": gsi_warm_writes
        }
        global_secondary_indexes = [
            {
                "IndexName": gsi_name,
                "KeySchema": gsi_key_schema,
                "Projection": gsi_projection,
                "ProvisionedThroughput": gsi_provisioned_throughput,
                "WarmThroughput": gsi_warm_throughput
            }
        ]
        
        # Define the warm throughput for the table
        warm_throughput = {
            "ReadUnitsPerSecond": table_warm_reads,
            "WriteUnitsPerSecond": table_warm_writes
        }
        
        # Create the DynamoDB client and create the table
        response = ddb.create_table(
            TableName=table_name,
            AttributeDefinitions=attribute_definitions,
            KeySchema=key_schema,
            ProvisionedThroughput=provisioned_throughput,
            GlobalSecondaryIndexes=global_secondary_indexes,
            WarmThroughput=warm_throughput
        )
        
        print(response)
    except ClientError as e:
        print(f"Error creating table: {e}")
        raise e
```

------
#### [ Javascript ]

```
import { DynamoDBClient, CreateTableCommand } from "@aws-sdk/client-dynamodb";

async function createDynamoDBTableWithWarmThroughput(
  tableName,
  partitionKey,
  sortKey,
  miscKeyAttr,
  nonKeyAttr,
  tableProvisionedReadUnits,
  tableProvisionedWriteUnits,
  tableWarmReads,
  tableWarmWrites,
  indexName,
  indexProvisionedReadUnits,
  indexProvisionedWriteUnits,
  indexWarmReads,
  indexWarmWrites,
  region = "us-east-1"
) {
  try {
    const ddbClient = new DynamoDBClient({ region: region });
    const command = new CreateTableCommand({
      TableName: tableName,
      AttributeDefinitions: [
          { AttributeName: partitionKey, AttributeType: "S" },
          { AttributeName: sortKey, AttributeType: "S" },
          { AttributeName: miscKeyAttr, AttributeType: "N" },
      ],
      KeySchema: [
          { AttributeName: partitionKey, KeyType: "HASH" },
          { AttributeName: sortKey, KeyType: "RANGE" },
      ],
      ProvisionedThroughput: {
          ReadCapacityUnits: tableProvisionedReadUnits,
          WriteCapacityUnits: tableProvisionedWriteUnits,
      },
      WarmThroughput: {
          ReadUnitsPerSecond: tableWarmReads,
          WriteUnitsPerSecond: tableWarmWrites,
      },
      GlobalSecondaryIndexes: [
          {
            IndexName: indexName,
            KeySchema: [
                { AttributeName: sortKey, KeyType: "HASH" },
                { AttributeName: miscKeyAttr, KeyType: "RANGE" },
            ],
            Projection: {
                ProjectionType: "INCLUDE",
                NonKeyAttributes: [nonKeyAttr],
            },
            ProvisionedThroughput: {
                ReadCapacityUnits: indexProvisionedReadUnits,
                WriteCapacityUnits: indexProvisionedWriteUnits,
            },
            WarmThroughput: {
                ReadUnitsPerSecond: indexWarmReads,
                WriteUnitsPerSecond: indexWarmWrites,
            },
          },
      ],
    });
    const response = await ddbClient.send(command);
    console.log(response);
  } catch (error) {
    console.error(`Error creating table: ${error}`);
    throw error;
  }
}
```

------

# Memahami throughput hangat DynamoDB dalam skenario yang berbeda
<a name="warm-throughput-scenarios"></a>

Berikut adalah beberapa skenario berbeda yang mungkin Anda temui saat bekerja dengan throughput hangat DynamoDB.

**Topics**
+ [Throughput hangat dan pola akses yang tidak merata](#warm-throughput-scenarios-uneven)
+ [Throughput hangat untuk tabel yang disediakan](#warm-throughput-scenarios-provisioned)
+ [Throughput hangat untuk meja sesuai permintaan](#warm-throughput-scenarios-ondemand)
+ [Throughput hangat untuk tabel sesuai permintaan dengan throughput maksimum yang dikonfigurasi](#warm-throughput-scenarios-max)

## Throughput hangat dan pola akses yang tidak merata
<a name="warm-throughput-scenarios-uneven"></a>

Sebuah tabel mungkin memiliki throughput hangat 30.000 unit baca per detik dan 10.000 unit tulis per detik, tetapi Anda masih bisa mengalami pelambatan pada membaca atau menulis sebelum mencapai nilai tersebut. Ini kemungkinan karena partisi panas. Sementara DynamoDB dapat mempertahankan penskalaan untuk mendukung throughput yang hampir tidak terbatas, setiap partisi individu dibatasi hingga 1.000 unit tulis per detik dan 3.000 unit baca per detik. Jika aplikasi Anda mendorong terlalu banyak lalu lintas ke sebagian kecil partisi tabel, pelambatan dapat terjadi bahkan sebelum Anda mencapai nilai throughput hangat tabel. Kami merekomendasikan mengikuti praktik [terbaik DynamoDB](bp-partition-key-design.md) untuk memastikan skalabilitas yang mulus dan menghindari partisi panas.

## Throughput hangat untuk tabel yang disediakan
<a name="warm-throughput-scenarios-provisioned"></a>

Pertimbangkan tabel yang disediakan yang memiliki throughput hangat 30.000 unit baca per detik dan 10.000 unit tulis per detik tetapi saat ini memiliki throughput yang disediakan sebesar 4.000 RCU dan 8.000 WCU. Anda dapat langsung menskalakan throughput yang disediakan tabel hingga 30.000 RCU atau 10.000 WCU dengan memperbarui pengaturan throughput yang telah disediakan. Saat Anda meningkatkan throughput yang disediakan di luar nilai-nilai ini, throughput hangat akan secara otomatis menyesuaikan dengan nilai baru yang lebih tinggi, karena Anda telah menetapkan throughput puncak baru. Misalnya, jika Anda mengatur throughput yang disediakan menjadi 50.000 RCU, throughput hangat akan meningkat menjadi 50.000 unit baca per detik.

```
"ProvisionedThroughput": 
    {
        "ReadCapacityUnits": 4000,
        "WriteCapacityUnits": 8000 
    }
"WarmThroughput": 
    { 
        "ReadUnitsPerSecond": 30000,
        "WriteUnitsPerSecond": 10000
    }
```

## Throughput hangat untuk meja sesuai permintaan
<a name="warm-throughput-scenarios-ondemand"></a>

Tabel on-demand baru dimulai dengan throughput hangat 12.000 unit baca per detik dan 4.000 unit tulis per detik. Meja Anda dapat langsung mengakomodasi lalu lintas berkelanjutan hingga level ini. Jika permintaan Anda melebihi 12.000 unit baca per detik atau 4.000 unit tulis per detik, throughput hangat akan secara otomatis menyesuaikan ke nilai yang lebih tinggi.

```
"WarmThroughput": 
    { 
        "ReadUnitsPerSecond": 12000,
        "WriteUnitsPerSecond": 4000
    }
```

## Throughput hangat untuk tabel sesuai permintaan dengan throughput maksimum yang dikonfigurasi
<a name="warm-throughput-scenarios-max"></a>

Pertimbangkan tabel sesuai permintaan dengan throughput hangat 30.000 unit baca per detik tetapi dengan [throughput maksimum](on-demand-capacity-mode-max-throughput.md) yang dikonfigurasi pada 5.000 unit permintaan baca (RRU). Dalam skenario ini, throughput tabel akan dibatasi hingga maksimum 5.000 RRU yang Anda tetapkan. Setiap permintaan throughput yang melebihi maksimum ini akan dibatasi. Namun, Anda dapat memodifikasi throughput maksimum khusus tabel kapan saja berdasarkan kebutuhan aplikasi Anda.

```
"OnDemandThroughput": 
    {
        "MaxReadRequestUnits": 5000,
        "MaxWriteRequestUnits": 4000
    }
"WarmThroughput": 
    { 
        "ReadUnitsPerSecond": 30000,
        "WriteUnitsPerSecond": 10000
    }
```