Skip to content

Commit

Permalink
perf benchmark with pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
sourabh1007 committed Nov 9, 2021
1 parent 0cddfe6 commit b6da5a4
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------

namespace CosmosBenchmark
{
using Microsoft.Azure.Cosmos;

internal class QueryStreamCrossPkWithPaginationV3BenchmarkOperation : QueryTV3BenchmarkOperation
{
public QueryStreamCrossPkWithPaginationV3BenchmarkOperation(
CosmosClient cosmosClient,
string dbName,
string containerName,
string partitionKeyPath,
string sampleJson) : base(cosmosClient, dbName, containerName, partitionKeyPath, sampleJson)
{
}

public override QueryDefinition QueryDefinition => new QueryDefinition("select * from T where T.id = @id")
.WithParameter("@id", this.executionItemId);

public override QueryRequestOptions QueryRequestOptions => new QueryRequestOptions()
{
MaxItemCount = 1
};

public override bool IsCrossPartitioned => true;

public override bool IsPaginationEnabled => true;

public override bool IsQueryStream => true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------

namespace CosmosBenchmark
{

using Microsoft.Azure.Cosmos;

internal class QueryStreamSinglePkWithPaginationV3BenchmarkOperation : QueryTV3BenchmarkOperation
{
public QueryStreamSinglePkWithPaginationV3BenchmarkOperation(
CosmosClient cosmosClient,
string dbName,
string containerName,
string partitionKeyPath,
string sampleJson) : base(cosmosClient, dbName, containerName, partitionKeyPath, sampleJson)
{
}

public override QueryDefinition QueryDefinition => new QueryDefinition("select * from T where T.id = @id")
.WithParameter("@id", this.executionItemId);

public override QueryRequestOptions QueryRequestOptions => new QueryRequestOptions()
{
MaxItemCount= 1,
PartitionKey = new PartitionKey(this.executionPartitionKey)
};

public override bool IsCrossPartitioned => false;

public override bool IsPaginationEnabled => true;

public override bool IsQueryStream => true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------

namespace CosmosBenchmark
{
using Microsoft.Azure.Cosmos;

internal class QueryTCrossPkWithPaginationV3BenchmarkOperation : QueryTV3BenchmarkOperation
{
public QueryTCrossPkWithPaginationV3BenchmarkOperation(
CosmosClient cosmosClient,
string dbName,
string containerName,
string partitionKeyPath,
string sampleJson) : base(cosmosClient, dbName, containerName, partitionKeyPath, sampleJson)
{
}

public override QueryDefinition QueryDefinition => new QueryDefinition("select * from T where T.id = @id")
.WithParameter("@id", this.executionItemId);

public override QueryRequestOptions QueryRequestOptions => new QueryRequestOptions()
{
MaxItemCount = 1
};

public override bool IsCrossPartitioned => true;

public override bool IsPaginationEnabled => true;

public override bool IsQueryStream => false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------

namespace CosmosBenchmark
{
using Microsoft.Azure.Cosmos;

internal class QueryTSinglePkWithPaginationV3BenchmarkOperation : QueryTV3BenchmarkOperation
{
public QueryTSinglePkWithPaginationV3BenchmarkOperation(
CosmosClient cosmosClient,
string dbName,
string containerName,
string partitionKeyPath,
string sampleJson) : base(cosmosClient, dbName, containerName, partitionKeyPath, sampleJson)
{
}

public override QueryDefinition QueryDefinition => new QueryDefinition("select * from T where T.id = @id")
.WithParameter("@id", this.executionItemId);

public override QueryRequestOptions QueryRequestOptions => new QueryRequestOptions()
{
MaxItemCount = 1,
PartitionKey = new PartitionKey(this.executionPartitionKey)
};

public override bool IsCrossPartitioned => false;

public override bool IsPaginationEnabled => true;

public override bool IsQueryStream => false;
}
}

0 comments on commit b6da5a4

Please sign in to comment.