>From Role Strategy Plugin or Configuration as a Code Plugin, the JMH examples show us that the intention is to provide a JMH environment which is fairly similar to a JUnit test environment. For example, as Mark mentioned, a JenkinsState was created to provide a JenkinsRule in the JMH environment to benchmark associated functionalities.
JMH provides a static state class where you can initialize almost everything you need to benchmark a step or a particular operation. I used that approach to benchmark git operations without using a JenkinsRule by just creating a custom class which would provide me fresh local repos for the lifetime of the benchmark. (the idea was simply copied from JUnit @Rule TemporaryFolder class) So it is fair to assume that anything we can test in a JUnit test, we can do that in a JMH benchmark too. On Sunday, June 7, 2020 at 10:26:31 PM UTC+5:30, Mark Waite wrote: > > Rishabh has created two JMH benchmarks for specific git operations inside > the Jenkins git plugin. He's running those micro benchmarks without a > JenkinsRule because the git plugin does not require a JenkinsRule to > operate at that level. > > I assume you need a JenkinsRule because you're running a pipeline. > However, it seems like you could make the pre-steps be part of the initial > creation of state, then run the micro benchmark solely on the subset of the > pipeline that interests you. > > On Sun, Jun 7, 2020 at 7:52 AM Ullrich Hafner <[email protected] > <javascript:>> wrote: > >> Is there a way to use the JMH within the individual steps of a plugin? >> The examples I have seen so far start with a given Jenkins instance and >> then call methods on Jenkins object model. >> >> So what is supported is something like >> >> jenkins.doSomething(); >> >> to measure the performance of one of Jenkins API methods. >> >> or >> >> job.scheduleBuild2() >> >> to measure the performance of a whole build pipeline. >> >> What I’m interested in my warnings plugin is the performance of >> individual steps in the pipeline. >> E.g., if I have the following steps: >> >> checkout scm >> withMaven(maven: 'mvn-default', mavenLocalRepo: >> '/var/data/m2repository', mavenOpts: '-Xmx768m -Xms512m') { >> sh 'mvn -ntp -V -e clean verify -f plugin/pom.xml >> -Dmaven.test.failure.ignore -DskipITs' >> } >> recordIssues tools: [java(), javaDoc()], aggregatingResults: 'true', >> id: 'java', name: 'Java' >> >> I am interested only in the results of the last step. >> >> It would be even better if I can obtain the performance results of the >> individual activities in my plugin. I.e. the recordWarnings step actually >> is composed of several steps: >> - parse warnings >> - compute fingerprints >> - collect blames from Git >> etc. >> >> Is this supported somehow yet? >> >> >> Am 22.06.2019 um 07:32 schrieb Abhyudaya Sharma <[email protected] >> <javascript:>>: >> >> Hi everyone, >> >> The Micro-benchmarking framework is now ready and is available through >> Plugin POM 3.46 or through Jenkins Test Harness 2.51. There is now a blog >> post <https://jenkins.io/blog/2019/06/21/performance-testing-jenkins/> >> summarizing >> it on jenkins.io. You can find examples for the benchmarks in the Role >> Strategy Plugin here >> <https://github.com/jenkinsci/role-strategy-plugin/tree/master/src/test/java/jmh/benchmarks>. >> >> Looking forward to your feedback and comments. >> >> Thanks >> Abhyudaya Sharma >> >> On Tuesday, 28 May 2019 11:50:14 UTC+5:30, Abhyudaya Sharma wrote: >>> >>> Hi everyone, >>> >>> As a part of this year's Google Summer of Code, I have been working on a >>> >>> framework for allowing Java Microbenchmark Harness (JMH) benchmarks to be >>> >>> run with Jenkins. The basic framework was implemented in the Role >>> Strategy >>> Plugin through this pull request: >>> https://github.com/jenkinsci/role-strategy-plugin/pull/63 . For each >>> benchmark, a temporary Jenkins instance is created, similar to how >>> JenkinsRule from Jenkins Test Harness does it. The benchmarks are run >>> through a unit test which allows them to be integrated with the normal >>> pull >>> request builds (if required). Apart from configuring the Jenkins instance >>> >>> for test using Java code, I've also added support for easily configuring >>> the >>> instance by YAML files using Jenkins Configuration as Code. The benchmark >>> >>> reports are generated as JSON files which are compatible with the >>> jmh-report >>> plugin. I have implemented a couple of benchmarks for the Role Strategy >>> Plugin which can be seen in the Role Strategy Plugin GitHub repository. I >>> >>> have attached screenshots of these results as visualized by the >>> jmh-report >>> plugin. To make the framework easier to use, I'm also working on running >>> the >>> benchmarks through a Maven profile. >>> >>> To make it available to the rest of the community, I would like to >>> propose >>> to make it either a part of Jenkins Test Harness or a part of new >>> library so >>> it can be used by other plugins and perhaps by Jenkins core itself. I >>> would >>> to love to hear your feedback, comments and suggestions. It would be even >>> >>> better if you could join the project's weekly meetings (Tuesdays and >>> Fridays >>> at 7:00 AM UTC) and help us improve this framework. >>> >>> Thanks >>> Abhyudaya >>> GitHub: AbhyudayaSharma >>> >>> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Jenkins Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-dev/7d49f6f8-79ed-49ab-a9ab-f94b376caf4a%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jenkinsci-dev/7d49f6f8-79ed-49ab-a9ab-f94b376caf4a%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Jenkins Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-dev/F0FEB18C-9B6F-495A-A4F8-31BAE16271C0%40gmail.com >> >> <https://groups.google.com/d/msgid/jenkinsci-dev/F0FEB18C-9B6F-495A-A4F8-31BAE16271C0%40gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/7826c83d-81f1-4b2f-ace9-ea3dc254f952o%40googlegroups.com.
