melix / jmh-gradle-plugin

Integrates the JMH benchmarking framework with Gradle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

With gradle 2.14.1, need to benchmark a method run after deployment to tomcat

hlms opened this issue · comments

commented

Hello all,

Need to benchmark a method in a tomcat webapp application.
The method is NOT unit testable.
Want to benchmark the method when it is executed after the deployment to tomcat.

Also, I've gradle version 2.14.1.

In the existing project build.gradle file, I've added the following:

plugins {
  id "me.champeau.gradle.jmh" version "0.3.1"
}

Notice the plugin version: 0.3.1.
Plugin version 4.0 and 4.1 fail with some exception.

I've added the following also to the existing project build.gradle:

dependencies {

    compile group: 'org.openjdk.jmh', name: 'jmh-core', version: '1.33'
    compile group: 'org.openjdk.jmh', name: 'jmh-generator-annprocess', version: '1.33'
    ...
}

Kindly guide me for the next steps.

Kindly correct me if the set-up is incorrect.

Gradle 2.14 is more than 5 years old. I would suggest you upgrade to a recent Gradle version first, so many things have changed.

commented

That's right, @melix .
I can't update the gradle immediately.

I'm still learning the JMH (and gradle). So need to confirm, is it possible to benchmark a method running in an application deployed in tomcat? Or does it strictly need a unit testable method?

No, this isn't possible. And for completion this isn't related to this plugin, this is just how JMH works. What you could do is expose a service via your Tomcat app which executes the method and call that service from a JMH benchmark, but it wouldn't measure exactly the same thing.

commented

Thank you, @melix .