Skip to content

Commit

Permalink
correct write read scenarios in benchmark (added ScenarioTimestamp fi…
Browse files Browse the repository at this point in the history
…eld)
  • Loading branch information
OlenaKostash committed Sep 17, 2024
1 parent 4144f56 commit 973556f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion benchmarks/TimescaleBenchmark/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void Run()
var readScenario = new ReadScenario().Create(connectionString, DateTime.UtcNow, sessionId: "0");

NBomberRunner
.RegisterScenarios(writeScenario)
.RegisterScenarios(readScenario)
.WithTestSuite("reporting")
.WithTestName("timescale_db_demo")
.Run();
Expand Down
1 change: 1 addition & 0 deletions benchmarks/TimescaleBenchmark/ReadScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public ScenarioProps Create(string connectionString, DateTime startTime, string
.Select(i => new PointDbRecord
{
Time = startTime.AddSeconds(-5 * i),
ScenarioTimestamp = TimeSpan.Zero,
Step = fakePoint.Step,
Scenario = fakePoint.Scenario,
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/TimescaleBenchmark/TimescaleBenchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<PackageReference Include="AutoBogus" Version="2.13.1" />
<PackageReference Include="NBomber" Version="5.7.0" />
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="RepoDb.PostgreSql" Version="1.13.1" />
<PackageReference Include="RepoDb.PostgreSql.BulkOperations" Version="1.13.1" />
<PackageReference Include="RepoDb.PostgreSql" Version="1.13.2-alpha1" />
<PackageReference Include="RepoDb.PostgreSql.BulkOperations" Version="1.13.2-alpha1" />
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 8 additions & 3 deletions benchmarks/TimescaleBenchmark/WriteScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@ public ScenarioProps Create(string connectionString)
{
await using var connection = new NpgsqlConnection(connectionString);
var curTime = DateTime.UtcNow;
var curTime = DateTime.UtcNow;
fakePoint.Time = curTime;
fakePoint.ScenarioTimestamp = TimeSpan.Zero;
fakePoint.SessionId = ctx.ScenarioInfo.InstanceNumber.ToString();
fakePoint.CurrentOperation = NBomber.Contracts.Stats.OperationType.Bombing;
await connection.BinaryBulkInsertAsync(SqlQueries.StepStatsTable, Enumerable.Repeat(fakePoint, 5));
try
{
await connection.BinaryBulkInsertAsync(SqlQueries.StepStatsTable, Enumerable.Repeat(fakePoint, 5));
}
catch (Exception ex)
{ }
return Response.Ok();
});
Expand Down

0 comments on commit 973556f

Please sign in to comment.