-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
provides prioritized sending for zero-stream frames; refactors benchm…
…arks Signed-off-by: Oleh Dokuka <[email protected]>
- Loading branch information
1 parent
48a7123
commit 0aad6ea
Showing
19 changed files
with
230 additions
and
529 deletions.
There are no files selected for viewing
This file contains 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,163 @@ | ||
apply plugin: 'java' | ||
apply plugin: 'idea' | ||
|
||
configurations { | ||
current | ||
baseline { | ||
resolutionStrategy.cacheChangingModulesFor 0, 'seconds' | ||
} | ||
} | ||
|
||
dependencies { | ||
// Use the baseline to avoid using new APIs in the benchmarks | ||
compileOnly "io.rsocket:rsocket-core:${perfBaselineVersion}" | ||
compileOnly "io.rsocket:rsocket-transport-local:${perfBaselineVersion}" | ||
|
||
implementation "org.openjdk.jmh:jmh-core:1.21" | ||
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:1.21" | ||
|
||
current project(':rsocket-core') | ||
current project(':rsocket-transport-local') | ||
baseline "io.rsocket:rsocket-core:${perfBaselineVersion}", { | ||
changing = true | ||
} | ||
baseline "io.rsocket:rsocket-transport-local:${perfBaselineVersion}", { | ||
changing = true | ||
} | ||
} | ||
|
||
task jmhProfilers(type: JavaExec, description:'Lists the available profilers for the jmh task', group: 'Development') { | ||
classpath = sourceSets.main.runtimeClasspath | ||
main = 'org.openjdk.jmh.Main' | ||
args '-lprof' | ||
} | ||
|
||
task jmh(type: JmhExecTask, description: 'Executing JMH benchmarks') { | ||
classpath = sourceSets.main.runtimeClasspath + configurations.current | ||
} | ||
|
||
task jmhBaseline(type: JmhExecTask, description: 'Executing JMH baseline benchmarks') { | ||
classpath = sourceSets.main.runtimeClasspath + configurations.baseline | ||
} | ||
|
||
class JmhExecTask extends JavaExec { | ||
|
||
private String include; | ||
private String fullInclude; | ||
private String exclude; | ||
private String format = "json"; | ||
private String profilers; | ||
private String jmhJvmArgs; | ||
private String verify; | ||
|
||
public JmhExecTask() { | ||
super(); | ||
} | ||
|
||
public String getInclude() { | ||
return include; | ||
} | ||
|
||
@Option(option = "include", description="configure bench inclusion using substring") | ||
public void setInclude(String include) { | ||
this.include = include; | ||
} | ||
|
||
public String getFullInclude() { | ||
return fullInclude; | ||
} | ||
|
||
@Option(option = "fullInclude", description = "explicitly configure bench inclusion using full JMH style regexp") | ||
public void setFullInclude(String fullInclude) { | ||
this.fullInclude = fullInclude; | ||
} | ||
|
||
public String getExclude() { | ||
return exclude; | ||
} | ||
|
||
@Option(option = "exclude", description = "explicitly configure bench exclusion using full JMH style regexp") | ||
public void setExclude(String exclude) { | ||
this.exclude = exclude; | ||
} | ||
|
||
public String getFormat() { | ||
return format; | ||
} | ||
|
||
@Option(option = "format", description = "configure report format") | ||
public void setFormat(String format) { | ||
this.format = format; | ||
} | ||
|
||
public String getProfilers() { | ||
return profilers; | ||
} | ||
|
||
@Option(option = "profilers", description = "configure jmh profiler(s) to use, comma separated") | ||
public void setProfilers(String profilers) { | ||
this.profilers = profilers; | ||
} | ||
|
||
public String getJmhJvmArgs() { | ||
return jmhJvmArgs; | ||
} | ||
|
||
@Option(option = "jvmArgs", description = "configure additional JMH JVM arguments, comma separated") | ||
public void setJmhJvmArgs(String jvmArgs) { | ||
this.jmhJvmArgs = jvmArgs; | ||
} | ||
|
||
public String getVerify() { | ||
return verify; | ||
} | ||
|
||
@Option(option = "verify", description = "run in verify mode") | ||
public void setVerify(String verify) { | ||
this.verify = verify; | ||
} | ||
|
||
@TaskAction | ||
public void exec() { | ||
setMain("org.openjdk.jmh.Main"); | ||
File resultFile = getProject().file("build/reports/" + getName() + "/result." + format); | ||
|
||
if (include != null) { | ||
args(".*" + include + ".*"); | ||
} | ||
else if (fullInclude != null) { | ||
args(fullInclude); | ||
} | ||
|
||
if(exclude != null) { | ||
args("-e", exclude); | ||
} | ||
if(verify != null) { // execute benchmarks with the minimum amount of execution (only to check if they are working) | ||
System.out.println("Running in verify mode"); | ||
args("-f", 1); | ||
args("-wi", 1); | ||
args("-i", 1); | ||
} | ||
args("-foe", "true"); //fail-on-error | ||
args("-v", "NORMAL"); //verbosity [SILENT, NORMAL, EXTRA] | ||
if(profilers != null) { | ||
for (String prof : profilers.split(",")) { | ||
args("-prof", prof); | ||
} | ||
} | ||
args("-jvmArgsPrepend", "-Xmx3072m"); | ||
args("-jvmArgsPrepend", "-Xms3072m"); | ||
if(jmhJvmArgs != null) { | ||
for(String jvmArg : jmhJvmArgs.split(" ")) { | ||
args("-jvmArgsPrepend", jvmArg); | ||
} | ||
} | ||
args("-rf", format); | ||
args("-rff", resultFile); | ||
|
||
System.out.println("\nExecuting JMH with: " + getArgs() + "\n"); | ||
resultFile.getParentFile().mkdirs(); | ||
|
||
super.exec(); | ||
} | ||
} |
File renamed without changes.
16 changes: 16 additions & 0 deletions
16
benchmarks/src/main/java/io/rsocket/PayloadsPerfSubscriber.java
This file contains 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,16 @@ | ||
package io.rsocket; | ||
|
||
import org.openjdk.jmh.infra.Blackhole; | ||
|
||
public class PayloadsPerfSubscriber extends PerfSubscriber<Payload> { | ||
|
||
public PayloadsPerfSubscriber(Blackhole blackhole) { | ||
super(blackhole); | ||
} | ||
|
||
@Override | ||
public void onNext(Payload payload) { | ||
payload.release(); | ||
super.onNext(payload); | ||
} | ||
} |
This file contains 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 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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 |
---|---|---|
|
@@ -12,3 +12,4 @@ | |
# limitations under the License. | ||
# | ||
version=1.0.0-RC6 | ||
perfBaselineVersion=1.0.0-RC5 |
This file contains 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 was deleted.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.