-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Event Grid Performance Test #19057
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
Closed
Closed
Event Grid Performance Test #19057
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
0e84432
Start of eventgrid perf test
YijunXieMS 4a836e9
Add azure-messaging-eventgrid-perf
YijunXieMS ed573d5
Update doc
YijunXieMS 4eaf716
Correct dependency directive
YijunXieMS 7ea42ef
Start of eventgrid perf test
YijunXieMS 00ac198
Add azure-messaging-eventgrid-perf
YijunXieMS 3002504
Update doc
YijunXieMS dca482f
Correct dependency directive
YijunXieMS 7dca4dc
Merge branch 'eg-perf' of github.com:YijunXieMS/azure-sdk-for-java in…
YijunXieMS 81e6d37
Merge branch 'master' into eg-perf
YijunXieMS 7429b69
Merge branch 'master' into eg-perf
YijunXieMS 5d01a52
Update to use eg 4.0.0
YijunXieMS 69d98ee
Merge branch 'master' into eg-perf
YijunXieMS bc367f7
Clean checkstyle errors
YijunXieMS 71c87f0
Fix pom.xml warnings
YijunXieMS 9070878
add com.azure:azure-messaging-eventgrid-perf to version_client.txt
YijunXieMS ef691bd
Remove maven-compiler-plugin from pom.xml
YijunXieMS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Release History | ||
|
|
||
| ## 1.0.0-beta.1 (Unreleased) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Azure Performance and Stress client library for Java | ||
|
|
||
| Azure Performance and Stress client library is a collection of classes which form the performance testing framework. It | ||
| helps developers create their performance tests for their APIs. | ||
|
|
||
| ## Getting started | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Java Development Kit (JDK) with version 8 or above | ||
|
|
||
| ### Adding the package to your product | ||
|
|
||
| [//]: # ({x-version-update-start;com.azure:perf-test-core;current}) | ||
| ```xml | ||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-messaging-evenggrid-perf</artifactId> | ||
| <version>1.0.0-beta.1</version> | ||
| </dependency> | ||
| ``` | ||
| [//]: # ({x-version-update-end}) | ||
|
|
||
| ## Key concepts | ||
|
|
||
|
|
||
| ## Examples | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ## Next steps | ||
|
|
||
| ## Contributing | ||
|
|
||
| For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). | ||
|
|
||
| 1. Fork it | ||
| 1. Create your feature branch (`git checkout -b my-new-feature`) | ||
| 1. Commit your changes (`git commit -am 'Add some feature'`) | ||
| 1. Push to the branch (`git push origin my-new-feature`) | ||
| 1. Create new Pull Request | ||
|
|
||
|  |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
|
|
||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
|
||
| <parent> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-client-sdk-parent</artifactId> | ||
| <version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} --> | ||
| <relativePath>../../parents/azure-client-sdk-parent</relativePath> | ||
| </parent> | ||
|
|
||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-messaging-eventgrid-perf</artifactId> | ||
| <version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:azure-messaging-eventgrid-perf;current} --> | ||
| <packaging>jar</packaging> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-messaging-eventgrid</artifactId> | ||
| <version>4.1.0-beta.1</version> <!-- {x-version-update;com.azure:azure-messaging-eventgrid;current} --> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>perf-test-core</artifactId> | ||
| <version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:perf-test-core;current} --> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-core-serializer-json-jackson</artifactId> | ||
| <version>1.2.0</version> <!-- {x-version-update;com.azure:azure-core-serializer-json-jackson;dependency} --> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-assembly-plugin</artifactId> | ||
| <version>3.2.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-assembly-plugin;external_dependency} --> | ||
| <executions> | ||
| <execution> | ||
| <phase>package</phase> | ||
| <goals> | ||
| <goal>single</goal> | ||
| </goals> | ||
| <configuration> | ||
| <archive> | ||
| <manifest> | ||
| <mainClass> | ||
| com.azure.messaging.eventgrid.perf.App | ||
| </mainClass> | ||
| </manifest> | ||
| </archive> | ||
| <descriptorRefs> | ||
| <descriptorRef>jar-with-dependencies</descriptorRef> | ||
| </descriptorRefs> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> |
29 changes: 29 additions & 0 deletions
29
.../azure-messaging-eventgrid-perf/src/main/java/com/azure/messaging/eventgrid/perf/App.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package com.azure.messaging.eventgrid.perf; | ||
|
|
||
| import com.azure.perf.test.core.PerfStressProgram; | ||
|
|
||
| /** | ||
| * Runs the Event Grid performance test. | ||
| * | ||
| * <p>To run from command line. Package the project into a jar with dependencies via mvn clean package. | ||
| * Then run the program with 'java -jar azure-messaging-eventgrid-perf-1.0.0-beta.1-jar-with-dependencies.jar' </p> | ||
| * | ||
| * <p> To run from IDE, set all the required environment variables in IntelliJ via Run -> EditConfigurations section. | ||
| * Then run the App's main method via IDE.</p> | ||
| */ | ||
| public class App { | ||
| /** | ||
| * Run the EventGrid perf test | ||
| * @param args the arguments | ||
| */ | ||
| public static void main(String[] args) { | ||
| PerfStressProgram.run(new Class<?>[] { | ||
| SendCloudEventsTest.class, | ||
| SendEventGridEventsTest.class, | ||
| SendCustomEventsTest.class | ||
| }, args); | ||
| } | ||
| } |
55 changes: 55 additions & 0 deletions
55
...essaging-eventgrid-perf/src/main/java/com/azure/messaging/eventgrid/perf/CustomEvent.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package com.azure.messaging.eventgrid.perf; | ||
|
|
||
| import java.time.OffsetDateTime; | ||
|
|
||
| class CustomEvent { | ||
| private final String id; | ||
| private final OffsetDateTime time; | ||
| private final String subject; | ||
| private final String foo; | ||
| private final String type; | ||
| private final String data; | ||
| private final String dataVersion; | ||
|
|
||
| CustomEvent(String id, OffsetDateTime time, String subject, String foo, | ||
| String type, String data, String dataVersion) { | ||
| this.id = id; | ||
| this.time = time; | ||
| this.subject = subject; | ||
| this.foo = foo; | ||
| this.type = type; | ||
| this.data = data; | ||
| this.dataVersion = dataVersion; | ||
| } | ||
|
|
||
| public String getData() { | ||
| return data; | ||
| } | ||
|
|
||
| public OffsetDateTime getTime() { | ||
| return time; | ||
| } | ||
|
|
||
| public String getDataVersion() { | ||
| return dataVersion; | ||
| } | ||
|
|
||
| public String getFoo() { | ||
| return foo; | ||
| } | ||
|
|
||
| public String getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public String getSubject() { | ||
| return subject; | ||
| } | ||
|
|
||
| public String getType() { | ||
| return type; | ||
| } | ||
| } |
49 changes: 49 additions & 0 deletions
49
...-eventgrid-perf/src/main/java/com/azure/messaging/eventgrid/perf/SendCloudEventsTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package com.azure.messaging.eventgrid.perf; | ||
|
|
||
| import com.azure.core.models.CloudEvent; | ||
| import com.azure.core.models.CloudEventDataFormat; | ||
| import com.azure.core.util.BinaryData; | ||
| import com.azure.perf.test.core.PerfStressOptions; | ||
| import reactor.core.publisher.Mono; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
| * Test performance of sending cloud events | ||
| */ | ||
| public class SendCloudEventsTest extends ServiceTest<PerfStressOptions> { | ||
| /** | ||
| * Create the SendCloudEventsTest | ||
| * @param options options | ||
| */ | ||
| public SendCloudEventsTest(PerfStressOptions options) { | ||
| super(options); | ||
| } | ||
|
|
||
| @Override | ||
| public void run() { | ||
| cloudEventPublisherClient.sendEvents(createEvents()); | ||
| } | ||
|
|
||
| // Perform the Async API call to be tested here | ||
| @Override | ||
| public Mono<Void> runAsync() { | ||
| return cloudEventPublisherAsyncClient.sendEvents(createEvents()); | ||
| } | ||
|
|
||
| private List<CloudEvent> createEvents() { | ||
| List<CloudEvent> events = new ArrayList<>(); | ||
| for (int i = 0; i < options.getCount(); i++) { | ||
| String dataPayload = String.join("", Collections.nCopies(options.getCount(), "A")); | ||
| CloudEvent ce = new CloudEvent("https://www.eventgrid.com/", "EG.Perf", | ||
| BinaryData.fromObject(new TestModelClass(dataPayload)), CloudEventDataFormat.JSON, "application/json"); | ||
| events.add(ce); | ||
| } | ||
| return events; | ||
| } | ||
| } |
57 changes: 57 additions & 0 deletions
57
...eventgrid-perf/src/main/java/com/azure/messaging/eventgrid/perf/SendCustomEventsTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package com.azure.messaging.eventgrid.perf; | ||
|
|
||
| import com.azure.core.util.BinaryData; | ||
| import com.azure.perf.test.core.PerfStressOptions; | ||
| import reactor.core.publisher.Mono; | ||
|
|
||
| import java.time.OffsetDateTime; | ||
| import java.util.ArrayList; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.UUID; | ||
|
|
||
| /** | ||
| * Test performance of sending custom events | ||
| */ | ||
| public class SendCustomEventsTest extends ServiceTest<PerfStressOptions> { | ||
|
|
||
| /** | ||
| * Create the SendCustomEventsTest | ||
| * @param options options. | ||
| */ | ||
| public SendCustomEventsTest(PerfStressOptions options) { | ||
| super(options); | ||
| } | ||
|
|
||
| @Override | ||
| public void run() { | ||
| customEventPublisherClient.sendEvents(createEvents()); | ||
| } | ||
|
|
||
| // Perform the Async API call to be tested here | ||
| @Override | ||
| public Mono<Void> runAsync() { | ||
| return customEventPublisherAsyncClient.sendEvents(createEvents()); | ||
| } | ||
|
|
||
| private List<BinaryData> createEvents() { | ||
| List<BinaryData> events = new ArrayList<>(); | ||
| for (int i = 0; i < options.getCount(); i++) { | ||
| String dataPayload = String.join("", Collections.nCopies(options.getCount(), "A")); | ||
| CustomEvent customEvent = new CustomEvent( | ||
| UUID.randomUUID().toString(), | ||
| OffsetDateTime.now(), | ||
| "Test", | ||
| "bar", | ||
| "Microsoft.MockPublisher.TestEvent", | ||
| dataPayload, | ||
| "0.1" | ||
| ); | ||
| events.add(BinaryData.fromObject(customEvent)); | ||
| } | ||
| return events; | ||
| } | ||
| } |
49 changes: 49 additions & 0 deletions
49
...ntgrid-perf/src/main/java/com/azure/messaging/eventgrid/perf/SendEventGridEventsTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package com.azure.messaging.eventgrid.perf; | ||
|
|
||
| import com.azure.core.util.BinaryData; | ||
| import com.azure.messaging.eventgrid.EventGridEvent; | ||
| import com.azure.perf.test.core.PerfStressOptions; | ||
| import reactor.core.publisher.Mono; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
| * Test performance of sending event grid events | ||
| */ | ||
| public class SendEventGridEventsTest extends ServiceTest<PerfStressOptions> { | ||
|
|
||
| /** | ||
| * Create the SendEventGridEventsTest | ||
| * @param options options | ||
| */ | ||
| public SendEventGridEventsTest(PerfStressOptions options) { | ||
| super(options); | ||
| } | ||
|
|
||
| @Override | ||
| public void run() { | ||
| eventGridEventPublisherClient.sendEvents(createEvents()); | ||
| } | ||
|
|
||
| // Perform the Async API call to be tested here | ||
| @Override | ||
| public Mono<Void> runAsync() { | ||
| return eventGridEventPublisherAsyncClient.sendEvents(createEvents()); | ||
| } | ||
|
|
||
| private List<EventGridEvent> createEvents() { | ||
| List<EventGridEvent> events = new ArrayList<>(); | ||
| for (int i = 0; i < options.getCount(); i++) { | ||
| String dataPayload = String.join("", Collections.nCopies(options.getCount(), "A")); | ||
| EventGridEvent event = new EventGridEvent("https://www.eventgrid.com/", "EG.Perf", | ||
| BinaryData.fromObject(new TestModelClass(dataPayload)), "v1"); | ||
| events.add(event); | ||
| } | ||
| return events; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be using this uri?