Skip to content

Actuator performance degradation for Jersey apps with non-static URLs #13281

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
renarsg opened this issue May 28, 2018 · 2 comments
Closed

Actuator performance degradation for Jersey apps with non-static URLs #13281

renarsg opened this issue May 28, 2018 · 2 comments
Assignees
Labels
status: duplicate A duplicate of another issue

Comments

@renarsg
Copy link

renarsg commented May 28, 2018

Issue observed with 2.0.1.RELEASE and 2.0.2.RELEASE.

When a Jersey application with actuator contains a URL with a parameter in the path that is not static, over time the performance degrades.

Locally using a simple test server performance goes from 0.2ms down to 45ms per request in 10 minutes or so (it may take a while for the problem to appear).

build.gradle:

buildscript {
	ext {
		springBootVersion = '2.0.2.RELEASE'
	}
	repositories {
		mavenCentral()
	}
	dependencies {
		classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
	}
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = ''
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
	mavenCentral()
}


dependencies {
	compile("org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}")
	compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}")
        compile "org.springframework.boot:spring-boot-starter-jersey:${springBootVersion}"
}

Endpoint definition:

@Component
@Path("/test")
public class Endpoint {

	@GET
        @Path("/{id}")
	public String message(@PathParam("id") String id) {
		return "Hello " + id;
	}

}

Test client to observe the issue:

public class TestClient {
  OkHttpClient client = new OkHttpClient();

  String get(String url) throws IOException {
    Request request = new Request.Builder()
        .url(url)
        .build();

    try (Response response = client.newCall(request).execute()) {
      return response.body().string();
    }
  }

  public static void main(final String[] args)  throws IOException {
    TestClient client = new TestClient();
    while(true) {
      long start = System.currentTimeMillis();
      for (int i = 0; i < 1000; i++) {
        client.get("http://localhost:8080/test/" + UUID.randomUUID().toString());
      }
      long end = System.currentTimeMillis();
      System.out.println("Time for 1000 requests: " + (end - start));
    }
  }
}

Here is the full code of test server and client:
test-server.zip
test-client.zip

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 28, 2018
@wilkinsona
Copy link
Member

I’m pretty sure that this is a duplicate of #12447 but need to double check.

@wilkinsona wilkinsona self-assigned this May 31, 2018
@wilkinsona
Copy link
Member

wilkinsona commented Jun 4, 2018

Thanks very much for the sample. It allowed to both reproduce the problem and to confirm that this is indeed a duplicate of #12447. I imagine it will also come in handy when verifying the fix for that issue.

@wilkinsona wilkinsona added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants