容量の処理
表により消費されるスループットおよびストレージを処理する方法について学習します。
Oracle NoSQL Database Cloud Serviceでアプリケーションを実行する前に、容量の見積りで説明されているように、表のスループットおよびストレージ容量を見積ってください。
表制限の設定
表を作成するときは、
TableRequest
クラス内のsetTableLimits
メソッドを使用して、表により消費されるスループットおよび容量を指定します。また、同じクラスを使用して、既存の表の表制限を変更することもできます。詳細は、Java APIリファレンス・ガイドを参照してください。
既存の表の制限を変更するには:
/* Create a new TableLimits object, setting values for read, write, and storage units */
TableLimits newLimits = new TableLimits(30, 10, 10);
/* create the TableRequest object. Set the table limits and the table name.*/
TableRequest treq = new TableRequest().setTableLimits(newLimits).
setTableName(tableName);
TableResult tres = handle.tableRequest(treq);
System.out.println("Altering table limits");
/* Wait for the operation to complete */
tres.waitForCompletion(handle, 20000, 1000);
新しい表制限を読み取るには、
GetTableRequest
クラスを使用します:GetTableRequest gtr = new GetTableRequest().setTableName(tableName);
tres = handle.getTable(gtr);
System.out.println("New table limits: " +
"read units=" + tres.getTableLimits().getReadUnits() +
", write units=" + tres.getTableLimits().getWriteUnits() +
", table size=" + tres.getTableLimits().getStorageGB()
);
表使用特性に関する情報を取得するには、Java APIリファレンス・ガイドの
NoSQLHandle.getTableUsage
APIを参照してください。