Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Schema Registry Avro] Add perf test for deserialize #21265

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
3. Create an Event Hubs account and populate the `.env` file with the relevant credentials.
4. Run the tests as follows

- detect language
- serialize
- `npm run perf-test:node -- SerializeTest --warmup 1 --iterations 10 --parallel 100 --duration 15 --items-count 1000`

- deserialize
- `npm run perf-test:node -- DeserializeTest --warmup 1 --iterations 10 --parallel 100 --duration 15 --items-count 1000`
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { AvroSerializerTest } from "./avroSerializerTest.spec";
import { PerfOptionDictionary } from "@azure/test-utils-perf";
import { MessageContent } from "@azure/schema-registry-avro";

interface SerializePerfTestOptions {
"items-count": number;
}

export class DeserializeTest extends AvroSerializerTest<SerializePerfTestOptions> {
options: PerfOptionDictionary<SerializePerfTestOptions> = {
"items-count": {
required: false,
description: "Number of array items",
shortName: "n",
longName: "items-count",
defaultValue: 1000,
},
};
private serialized: MessageContent | undefined;

constructor() {
super();
this.options = this.parsedOptions;
}

async setup(): Promise<void> {
this.serialized = await this.serializer.serialize(
{
name: "test",
favoriteNumbers: [...Array(this.options["items-count"].value).keys()],
},
AvroSerializerTest.schema
);
}

async run(): Promise<void> {
await this.serializer.deserialize(this.serialized!);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

import { PerfProgram, selectPerfTest } from "@azure/test-utils-perf";
import { SerializeTest } from "./serialize.spec";
import { DeserializeTest } from "./deserialize.spec";

import dotenv from "dotenv";
dotenv.config();

console.log("=== Starting the perf test ===");

const perfProgram = new PerfProgram(selectPerfTest([SerializeTest]));
const perfProgram = new PerfProgram(selectPerfTest([SerializeTest, DeserializeTest]));

perfProgram.run();