Skip to content

[JAVA][FEIGN] Removing hardcoded HTTP Client which is causing performance issues #21085

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

Merged

Conversation

sushma3690
Copy link
Contributor

@sushma3690 sushma3690 commented Apr 13, 2025

Fixing performance issues due to Hardcoded HTTP client

  1. Breaking change was introduced here. (Somehow, the PR got merged despite a review comment suggested to revert the same in 2023 for a different reason)
  2. This is causing performance issues as new tcp connection is created for each new request which is caught in performance tests.
  3. Lot of TCP connections are created which in turn results in exceeded CPU utilisation and eventually timeout errors as all the resources are exhausted. For example, below image shows the number of TCP connections opened by my application which is using feign client to be 64. For 64 requests, it should have been able to reuse the 1 connection with connection pooling instead of creating 64 connections.
image

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in Git BASH)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@wing328
Copy link
Member

wing328 commented Apr 13, 2025

@sushma3690 thanks for the PR 🙏

Somehow, the PR got merged despite a review comment suggested to revert the same

Can you please share the URL to the comment? I reviewed the PR again but couldn't find it.

@sushma3690
Copy link
Contributor Author

  1. here

@wing328 Here is the comment url.

wing328 referenced this pull request Apr 13, 2025
* Implement unit tests for feign client

Implement tests
Migrate to junit 5

* Default feign client does not support PATCH verb

Default feign client does not support PATCH verb

* Remove test for GET endpoint with request body

* Configure junit in gradle build

* Configure logback for unit tests

* Add missing dependencies to sbt

* Fix gradle dependency

* Add logback to gradle unit test

* Regenerate samples

* Make junit test classes package private

* Make junit test classes package private

* Update samples

* Organize imports

* Organize imports
@wing328
Copy link
Member

wing328 commented Apr 13, 2025

thanks. i missed that

cc @hugo-ma-alves (author of the PR in question)

@wing328 wing328 added this to the 7.13.0 milestone Apr 13, 2025
@sushma3690
Copy link
Contributor Author

@wing328 I will generate the samples and update the PR

@wing328
Copy link
Member

wing328 commented Apr 13, 2025

https://github.com/OpenAPITools/openapi-generator/actions/runs/14430406203/job/40464641609?pr=21085

please update the samples (step 3 in pr checklist) to fix the CI failure.

@sushma3690
Copy link
Contributor Author

@wing328 I have updated the samples, Can you please do the needful to trigger the workflows. Thank you

@sushma3690
Copy link
Contributor Author

sushma3690 commented Apr 13, 2025

++ Adding Java committee

@wing328 / @bbdouglas / @sreeshas / @jfiala / @lukoyanov / @cbornet / @jeff9finger / @karismann / @Zomzog / @lwlee2608 / @martin-mfg I have updated the samples, Can someone please do the needful to trigger the workflows.

Thank you

@wing328
Copy link
Member

wing328 commented Apr 17, 2025

@sushma3690
Copy link
Contributor Author

@sushma3690
Copy link
Contributor Author

sushma3690 commented Apr 17, 2025

https://github.com/OpenAPITools/openapi-generator/actions/runs/14430865853/job/40702608092?pr=21085

looking into it. will get back in few minutes

  1. added missing samples @wing328
image
  1. all Tests passed on running ./mvnw test
image

@sushma3690
Copy link
Contributor Author

@wing328 All checks passed, can you please approve the PR so that we can merge it. Thank you !

@wing328 wing328 merged commit f9f5af5 into OpenAPITools:master Apr 17, 2025
73 checks passed
@wing328
Copy link
Member

wing328 commented Apr 17, 2025

just merged it. thanks for the contribution

@lesteenman
Copy link

This has introduced a backwards incompatible change: #21187.

@wing328
Copy link
Member

wing328 commented Apr 30, 2025

@lesteenman thanks for reporting the issue

@sushma3690 can you please review the issue when you've time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants