-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Optimise RESTEasy for closed world #4345
Comments
@patriot1burke could you take this or assign someone? |
I read it as RESTEasy reads the annotation on the method being call for every request without even caching anything or preparing its metadata? Is that correct? |
Correct, these are profiling snapshots taken at runtime: under load, after the application booted and after it completed warmup. |
For the JSON part of things, I'll try and revive #3553 which has fallen far behind the latest RESTEasy + JSON-B developments. |
I took a super quick look at part of this and it seems like
is being used heavily in the glue code in Quarkus (see I'll take a closer look soon |
A first simple PR for RESTEasy has been opened here |
@Sanne I am not seeing |
Added another RESTEasy PR to address a small performance optimization. This will also require a tiny modification in |
@geoand I've seen those running the POC for techempower which I shared here: When reporting this I was testing Quarkus / master 2 weeks ago, so I guess it's possible other things changed in the mean time -- I'll run this all again when we have those RESTEasy patches merged, I guess ignore those for now if you can't reproduce it. |
Added one more RESTEasy PR here. |
The last PR was closed because it could lead to a DoS but maybe we could just hide it behind a flag that could only be turned in certain circumstances? |
Actually, I think you might want to experiment with a fixed size cache (you could clear up the cache once it reaches a configurable size threshold). |
@asoldano do you have any candidate classes in mind? |
@asoldano does RESTEasy have a caching implementation around? We have a cache based on Caffeine based in Quarkus; I guess we could use that one, if RESTEasy could allow to "inject" a custom cache implementation. |
@Sanne the cache would mostlikely move to Quarkus anyway - at least based on the latest implementation I had done that only cached things when a request was successful. |
@Sanne the problem would be that we would have to include the caffeine extension in the |
@Sanne @geoand , RESTEasy has a caching mechanism, but that's really for the HTTP Cache control only. I also unsure the scenario here deserves relying on Caffeine, creating a mechanism for plugging that into RESTEasy, etc. How about a ConcurrentHashMap that's evicted when it reaches a given size? The threshold could be controlled with a property (MP Config), the cache migh even be disabled by default (say, default threshold is 0) |
@asoldano I'm fine with that. Let me create a RESTEasy and a corresponding Quarkus PR with that I have in mind when I say that I want to move the caching stuff into Quarkus. |
This is done because the computation of the data is expensive Relates to: quarkusio#4345
This is done because the computation of the data is expensive Relates to: quarkusio#4345
well that's better than nothing but it's not ideal. If someone had a large anough application to cross the threshold with legit URLs you'd occasionally see performance go up/down. And in case of non-legit URLs it's again exposing you to DDOs by both adding load on the dumb cache and by slowing down the system by wiping legit cache users - compounding the load which is not good when under attack. A true cache would evict the less "valuable" entry.
Right I don't mean you to have RESTEasy commit on Caffeine, but if you could expose an interface for us to implement, we'd be able to inject a better cache implementation (incidentally using Caffeine s we have it in Quarkus already - and because it's excellent).
It could be optional / automatic. Other extension processors do something similar: if the other feature X is available, then enable integration code with it. Otherwise, don't. This would imply that people adding the Caffeine extension to a RESTEasy-using app would see improved performance, without doing anything at all other than adding the extension. |
Sure, it would be a compromise.
Well, if you're willing to go this way, that's ok with me. |
Well for the time being I think we'll be fine with keeping the caching in Quarkus like #4563 suggests |
This is done because the computation of the data is expensive Relates to: quarkusio#4345
Agreed. But let's not forget to implement the proper solution later, could
you track it as a subsequent improvement issue?
…On Tue, 15 Oct 2019, 16:47 Georgios Andrianakis, ***@***.***> wrote:
Well for the time being I think we'll be fine with keeping the caching in
Quarkus like #4563 <#4563>
suggests
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4345?email_source=notifications&email_token=AAAKMTJW5ZGZULKS6KRLB73QOXQ2DA5CNFSM4I5BQYD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBJIMWA#issuecomment-542279256>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAKMTPVCXQ25TKA2FOVOQ3QOXQ2DANCNFSM4I5BQYDQ>
.
|
This is done because the computation of the data is expensive Relates to: quarkusio#4345
This issue/pullrequest has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Closing this as it has been implemented in the form of RESTEasy Reactive |
is RESTEasy Reactive the only way forward? I still see performance issues when using the "classic" one. |
RESTEasy Classic certainly is not going anywhere, but our focus from a Quarkus PoV is on RESTEasy Reactive |
Ok but why close this then? I still hope this can be improved |
Who is going to improve it? And where is the improvement going to go? If it's in Quarkus (which I doubt anyone will do at this point), then it would make sense to leave the ticket open. But if the fix is going to be in RESTEasy, then it's probably best to track it in the appropriate issue tracker |
Adding @jamezp here. James, I think it might be worth isolating the possible improvements that could go into RESTEasy and create JIRAs for them. |
Profling a Quarkus application it's immediatley visible that the current RESTEasy extension isn't taking advantage of the closed world assumption:
Annotation scanning and type introspection:
And more..
I suppose this implies we can improve it a lot still?
The above methods have been identified when looking for strong allocators; this implies memory consumption could be cut down by dodging these operations.
The text was updated successfully, but these errors were encountered: