Skip to content
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

Performance discussion about default openfeign client #2267

Open
raizoor opened this issue Dec 14, 2023 · 6 comments
Open

Performance discussion about default openfeign client #2267

raizoor opened this issue Dec 14, 2023 · 6 comments

Comments

@raizoor
Copy link

raizoor commented Dec 14, 2023

Resume
Discussion about default client performance of spring-cloud-openfeign

Versions
Java 17
Springboot 2.7.18
spring-cloud-dependencies 2021.0.8

Scenario

During a performance tests in a microservice that contain a 3 feign clients, it was possible to saw a high GC usage (i.e. high cpu utilization as well) in two methods, as we can see at profiler image bellow

profiler-onlySpringCloudFeign

We have a high tps scenario here - 110tps. The situation was absolutely unstable and we has too much resources to handle with that.

After studying the issue I decided to use lib {io.github.openfeign:feign-httpclient:11.8} and do a new evaluation. To my surprise, we had a significant improvement in resource usage, as feign started using other classes and no longer generated as many objects, as shown bellow

springCloudFeign-httpClient

So, my question: Is this the expected behavior of the default implementation or is there something I did incorrectly, because we've a big difference here.

Code

I don't have a high customization clients, only a custom decoder and base64 auth, as bellow

@FeignClient(value = "...", url = "...",
        configuration = ClientConfig.class)
public interface .. {

    @PostMapping("..")
    SpecificObject post(
            @RequestHeader("..") Boolean ..,
            @RequestBody SpecificObject ..
    );
}

image

basicAuthInterceptor

@velo
Copy link
Member

velo commented Dec 14, 2023

@raizoor are you willing to run flame charts on your project? That would help identify the issue

@raizoor
Copy link
Author

raizoor commented Dec 14, 2023

@velo I've some detailed information about cpu / memory local profiler (visualVM) that I can share too. If I can help with other actions, please let me know.

@velo
Copy link
Member

velo commented Dec 14, 2023

A flame chart would show where the problem is.

@raizoor
Copy link
Author

raizoor commented Dec 14, 2023

flame-1

flame-2

@velo
Copy link
Member

velo commented Dec 14, 2023

Bit tough to read this, specially in 2 separated images....
https://github.com/aragozin/jvm-tools/

Can you generate the SVG and send it to me?

java -jar sjk.jar stcap --pid $PID --timeout 1M --output /tmp/stcap.out 
java -jar sjk.jar  flame --file /tmp/stcap.out --output /tmp/flame.html

You probably want to email me https://github.com/OpenFeign/feign/blob/master/pom.xml#L145

@raizoor
Copy link
Author

raizoor commented Dec 18, 2023

@velo Flame are in your email.

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

No branches or pull requests

2 participants