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

[Perf] [Service Bus] [Event Hubs] Event Based SDKs Perf Framework - part 2 #18859

Conversation

HarshaNalluru
Copy link
Member

@HarshaNalluru HarshaNalluru commented Nov 29, 2021

What's in the PR?

  • Event-based(SDKs) perf test class for the AMQP SDKs
  • Example mock receiver with the subscribe method(drawing parallels with service-bus)
  • Perf test for the subscribe method offered by the
    • mock receiver similar to service-bus receiver
    • mock receiver similar to event-hubs receiver
    • service-bus receiver
    • event-hubs receiver
  • Minor refactorings/bug fixes

Fixes #18471
Fixes #17952

@ghost ghost added Service Bus Storage Storage Service (Queues, Blobs, Files) labels Nov 29, 2021
@HarshaNalluru HarshaNalluru changed the title [Perf] [Service Bus] Event Based SDKs Perf Framework - part 2 [Perf] [Service Bus] [Event Hubs] Event Based SDKs Perf Framework - part 2 Feb 7, 2022
@azure-sdk
Copy link
Collaborator

API changes have been detected in @azure/event-hubs. You can review API changes here

Copy link
Member

@jeremymeng jeremymeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me. I have some comments (mostly stylish)

export interface SubscribeOptions {
/**
* The maximum number of partitions to receive from.
* - **Default**: `12`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious how the default is determined?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was just a random number, do you have any preference/suggestion?

/**
* Raises the error after the specified time.
*/
raiseErrorAfterInSeconds: number;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: does raiseErrorDelayInSeconds read better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delayToRaiseErrorInSeconds probably too long...

- Methods do not perform any async work, and sync methods add less overhead to perf framework
- Now matches NoOpTest * AverageBatchSize
- Also update options to match .NET
Copy link
Member

@mikeharder mikeharder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix raiseErrorAfterInSeconds and I can continue reviewing.

},
maxEventsPerSecond: {
description: "Max rate to receive in events/sec",
defaultValue: 1000,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maxEventsPerSecond should default to unspecified (unthrottled)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
Updated 😎

},
raiseErrorAfterInSeconds: {
description: "Raises error after the given duration - in seconds",
defaultValue: 15,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raiseErrorAfterInSeconds should default to unspecified (error never thrown).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

this.handlePartition(handlers.processEvents, i, maxEventsPerSecondPerPartition)
);
}
if (options?.raiseErrorAfterInSeconds) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raiseErrorAfterInSeconds does not appear to be working for me. If I set this to say 3, the test keeps running for the normal duration and no error is raised.

Copy link
Member Author

@HarshaNalluru HarshaNalluru Feb 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I set this to say 3, the test keeps running for the normal duration and no error is raised.

Error should have been thrown(or logged at 3 seconds), but the test is active since the duration timeout wasn't cleared.
Updated the "program" to clear the timeout once the runAll calls were done.

Copy link
Member

@mikeharder mikeharder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending remaining feedback

{
processEvents: async (events: ReceivedEventData[], _context: PartitionContext) => {
for (const _event of events) {
console.log(_event.sequenceNumber, _context.partitionId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove debugging console.log

);
await producer.sendBatch(batch);
numberOfEventsSent = numberOfEventsSent + batch.count;
console.log(numberOfEventsSent);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove debugging console.log

const batch = await producer.createBatch({ partitionId });
let numberOfEventsSent = 0;
// add events to our batch
while (numberOfEventsSent <= numberOfEventsPerPartition) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
while (numberOfEventsSent <= numberOfEventsPerPartition) {
while (numberOfEventsSent < numberOfEventsPerPartition) {

Off-by-one bug

@HarshaNalluru HarshaNalluru enabled auto-merge (squash) March 21, 2022 18:58
@HarshaNalluru HarshaNalluru merged commit efe321c into Azure:main Mar 21, 2022
@HarshaNalluru HarshaNalluru deleted the harshan/issue/18471-event-perf-framework-part-2 branch March 22, 2022 18:03
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-js that referenced this pull request Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Service Bus Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
5 participants