Skip to content

Conversation

@dhensche
Copy link

Mutating the client (which property calls do) after creation, changes the ClientConfig mode to RequestScoped. This forces Jersey to reinitialize the injection scope with each request, which degrades performance when many API calls are made

Running the client with a profiler led me down the rabbit hole of, "why is Jersey calling initRuntime on the ClientConfig$State for each request". This task is slow and requires the creation of a new InjectionManager for each request. The calls to set the redirect and timeout properties made in invocation were what was doing it. It did not look like those needed to happen with each invocation, and instead could be done during client initialization so that Jersey would re-use the config for subsequent requests. Our project uses 5.x because we are stuck on java 8 so I made the change there. Let me know what I need to do to actually get this change approved and released. Thanks!

- Mutating the client (which property calls do) after creation, changes the ClientConfig mode to RequestScoped. This forces Jersey to reinitialize the injection scope with each request, which degrades performance when many API calls are made
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant