Azure Cosmos DB コンテナーに標準 (手動) のスループットをプロビジョニングする - API for NoSQL

適用対象: NoSQL

この記事では、Azure Cosmos DB for NoSQL のコンテナーに標準 (手動) のスループットをプロビジョニングする方法について説明します。 スループットは、単一のコンテナーを対象にプロビジョニングできるほか、データベースを対象にプロビジョニングして、それをデータベース内の複数のコンテナーで共有することもできます。 コンテナーのスループットは、Azure portal、Azure CLI、Azure Cosmos DB SDK のいずれかを使用してプロビジョニングできます。

別の API を使用している場合は、MongoDB 用 APICassandra 用 APIGremlin 用 API のスループット プロビジョニングに関する記事を参照してください。

Azure portal

  1. Azure portal にサインインします。

  2. 新しい Azure Cosmos DB アカウントを作成するか、既存の Azure Cosmos DB アカウントを選びます。

  3. [データ エクスプローラー] ウィンドウを開いて [新しいコンテナー] を選択します。 次に、以下の詳細を指定します。

    • 新しいデータベースを作成するか、既存のデータベースを使用するかを指定します。
    • コンテナー ID を入力します。
    • パーティション キーの値を入力します (例: /ItemID)。
    • 自動スケーリングまたは手動スループットを選択し、必要なコンテナー スループットを入力します (例: 1,000 RU/秒)。 プロビジョニングするスループットを入力します (例: 1,000 RU)。
    • [OK] を選択します。

    Screenshot of Data Explorer, with New Collection highlighted

Azure CLI または PowerShell

専用スループットを持つコンテナーの作成については、以下を参照してください。

.NET SDK

Note

Cassandra および MongoDB 用 API を除くすべての Azure Cosmos DB API に対するスループットをプロビジョニングするには、NoSQL 用 API の Azure Cosmos SDK を使用します。

// Create a container with a partition key and provision throughput of 400 RU/s
DocumentCollection myCollection = new DocumentCollection();
myCollection.Id = "myContainerName";
myCollection.PartitionKey.Paths.Add("/myPartitionKey");

await client.CreateDocumentCollectionAsync(
    UriFactory.CreateDatabaseUri("myDatabaseName"),
    myCollection,
    new RequestOptions { OfferThroughput = 400 });

JavaScript SDK

// Create a new Client
const client = new CosmosClient({ endpoint, key });

// Create a database
const { database } = await client.databases.createIfNotExists({ id: "databaseId" });

// Create a container with the specified throughput
const { resource } = await database.containers.createIfNotExists({
id: "containerId",
throughput: 1000
});

// To update an existing container or databases throughput, you need to user the offers API
// Get all the offers
const { resources: offers } = await client.offers.readAll().fetchAll();

// Find the offer associated with your container or the database
const offer = offers.find((_offer) => _offer.offerResourceId === resource._rid);

// Change the throughput value
offer.content.offerThroughput = 2000;

// Replace the offer.
await client.offer(offer.id).replace(offer);

次のステップ

Azure Cosmos DB でのスループットのプロビジョニングについては、次の記事を参照してください。