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 improvements #2479

Merged
merged 1 commit into from Jul 28, 2020
Merged

Performance improvements #2479

merged 1 commit into from Jul 28, 2020

Conversation

bcluap
Copy link
Contributor

@bcluap bcluap commented Jul 27, 2020

  • Avoid unnecessary use of URI.create - rather do more lazily
  • Multivalued maps will 99% of the time have 1 or maybe 2 entries for a key so don't allocate memory for 10
  • Avoid unnecessary matcher creation when decoding when a string does not contain % in it - which is the more likely case for URI's to Rest resources

These changes increase throughput by about 2% on a simple Rest service and were found doing some hotspot analysis on load tests on Quarkus.

- Avoid unnecessary use of URI.create - rather do more lazily
- Multivalued maps will 99% of the time have 1 or maybe 2 entries for a key so don't allocate memory for 10
- Avoid unnecessary matcher creation when decoding when a string does not contain % in it - which is the more likely case for URI's to Rest resources

These changes increase throughput by about 2% on a simple Rest service.
@asoldano asoldano added the main label Jul 27, 2020
@asoldano
Copy link
Member

@bcluap , thanks for your contribution. Since this is your first one, please note that we require that all contributions are made under the terms of the ASL 2.0 License: http://www.apache.org/licenses/LICENSE-2.0
Do you agree to these terms?

@bcluap
Copy link
Contributor Author

bcluap commented Jul 27, 2020 via email

@asoldano asoldano merged commit cfc1109 into resteasy:master Jul 28, 2020
asoldano pushed a commit to asoldano/Resteasy that referenced this pull request Sep 17, 2020
- Avoid unnecessary use of URI.create - rather do more lazily
- Multivalued maps will 99% of the time have 1 or maybe 2 entries for a key so don't allocate memory for 10
- Avoid unnecessary matcher creation when decoding when a string does not contain % in it - which is the more likely case for URI's to Rest resources

These changes increase throughput by about 2% on a simple Rest service.

Co-authored-by: Paul Carter-Brown <paul.carter-brown@jini.guru>
ronsigal added a commit that referenced this pull request Sep 17, 2020
* [RESTEASY-2625]:Fix @produces(text/event-stream

* [RESTEASY-2610] Upgrade MicroProfile REST Client to 1.4.1

* [RESTEASY-2595] Add getLinks method with a custom class loader

* [RESTEASY-2597] add methods and test to support setting

* [RESTEASY-2300] allow empty Host header for netty adapters

* [RESTEASY-2300] test-cases for empty Host header field

* Remove deps from the BOM that don't exist in the current version

* [RESTEASY-2633] Encode code points that span multiple characters (#2456)

Fixes RESTEASY-2633

* [RESTEASY-2637] Fix issue with Spring Web parameters encoding (#2453)

Fixes: quarkusio/quarkus#10133

* Upgrade to wildfly 20.0.0.Final

* Disable wiremock banner

* [RESTEASY-2639] Bump version.log4j from 2.9.1 to 2.13.3 in /resteasy-dependencies-bom (#2460)

Bumps `version.log4j` from 2.9.1 to 2.13.3.

Updates `log4j-api` from 2.9.1 to 2.13.3

Updates `log4j-core` from 2.9.1 to 2.13.3

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [RESTEASY-2634] Fix HttpHeaders.getAcceptableLanguages (#2458)

JAX-RS mandates that HttpHeaders.getAcceptableLanguages() returns a
single wildcard locale instance if no acceptable languages are defined.

* [RESTEASY-2642] Add doPrivs to sys prop checks (#2467)

* [RESTEASY-2642] Add doPrivs to sys prop checks

Signed-off-by: Andy McCright <j.andrew.mccright@gmail.com>

* Review comment: only use doPriv if SecMgr is used

Signed-off-by: Andy McCright <j.andrew.mccright@gmail.com>

* [RESTEASY-2645] Upgrade Jackson to 2.11.1

* RESTEASY-2648 Upgrade json-patch to 1.13

* [RESTEASY-2648][RESTEASY-2327] Additional minor fix to modules and removal of exclusion

* [RESTEASY-2649] Upgrade shrinkwrap to 2.2.7 (#2473)

* [RESTEASY-2646]:Fix match cache in  RootNode grows infinitely (#2471)

* [RESTEASY-2646]:Initial fix

* [RESTEASY-2646]:More improvement

* [RESTEASY-2646]:Get match catch config from system property

* Code cleanup

* [RESTEASY-2646]:Without caching match if the ContentType contains parameters

* Test for RootNode cache size limit

* Fix test

Co-authored-by: Rostislav Svoboda <rsvoboda@redhat.com>

* Test for RESTEASY-2633

* [RESTEASY-2659] Performance improvements (#2479)

- Avoid unnecessary use of URI.create - rather do more lazily
- Multivalued maps will 99% of the time have 1 or maybe 2 entries for a key so don't allocate memory for 10
- Avoid unnecessary matcher creation when decoding when a string does not contain % in it - which is the more likely case for URI's to Rest resources

These changes increase throughput by about 2% on a simple Rest service.

Co-authored-by: Paul Carter-Brown <paul.carter-brown@jini.guru>

* RESTEASY-2662 Don't create a context if it does not exist

* [RESTEASY-2666] Upgrade httpclient/httpcore

* [RESTEASY-2670] Ensure immutability and properly rely on builders

* [RESTEASY-2669] Dealt with a few warnings

* [RESTEASY-2668] Remove SseEventOutputProvider

* [RESTEASY-2667] Removing SerializableProvider

* [RESTEASY-2669] Misc cleanup and warning fixes

* [RESTEASY-2669] Further warnings' cleanup in core

* RESTEASY-2674 Escape sign of quotation to see the value of parameter

* [RESTEASY-2661]:MediaTypeMap shared across threads, but cache is not … (#2498)

* [RESTEASY-2661]:MediaTypeMap shared across threads, but cache is not thread-safe

* Update MediaTypeMap.java

Removing comment about volatility.

Co-authored-by: Ron Sigal <rsigal@redhat.com>

* [RESTEASY-2549] Remove resteasy-validator-provider source dependency on Hibernate Validate.

[RESTEASY-2549] Moved NonCDIValidatorFactoryTest to integration-tests-embedded

* Do not use ResteasyProviderFactory.getInstance() in SseEventProvider

* [RESTEASY-2684] Statically set provider factory on ResteasyClientBuilderImpl (#2504)

* [RESTEASY-2684] Statically set provider factory on ResteasyClientBuilderImpl

* [RESTEASY-2684] Added unit test.

* [RESTEASY-2684] Fix new unit test.

Co-authored-by: Ron Sigal <rsigal@redhat.com>

* [RESTEASY-2683] NPE in ApacheHttpClient43Test because cache is null in MediaTypeMap (#2501)

* [RESTEASY-2592] removed profile forward.compatibility and annotation NotForForwardCompatibility

* RESTEASY-2678 - Fix read priority from @priority with @RegisterProvider.

* [RESTEASY-2687] Revisit fix in previous commit and remove ResteasyProviderFactory.getInstance() in other locations as well

* Deprecated unused classes

* [RESTEASY-2592] Restore unintentially disabled testsuites

* Update target containers

* [RESTEASY-2627] Chain thenCompose properly

* [RESTEASY-2689] Fix SseEventOutputImpl wrong CompletionStage composition sequence

* RESTEASY-2678 - Fix test.

* [RESTEASY-2689]:Add a test case

* [RESTEASY-2685] Merge client headers with MP REST Client

* Add test to verify behavior

* Needed to reset beanManager inside the extension for testing

* Build to 4.5.7-SNAPSHOT

Co-authored-by: Jim Ma <ema@redhat.com>
Co-authored-by: Gytis Trikleris <gytis@redhat.com>
Co-authored-by: R Searls <rsearls@redhat.com>
Co-authored-by: Ivo Studensky <istudens@redhat.com>
Co-authored-by: Alexey Loubyansky <olubyans@redhat.com>
Co-authored-by: Stuart Douglas <stuart.w.douglas@gmail.com>
Co-authored-by: Georgios Andrianakis <geoand@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christoph Böhme <christoph@b3e.net>
Co-authored-by: Andy McCright <j.andrew.mccright@gmail.com>
Co-authored-by: George Gastaldi <gegastaldi@gmail.com>
Co-authored-by: Tomaz Cerar <tomaz.cerar@gmail.com>
Co-authored-by: Rostislav Svoboda <rsvoboda@redhat.com>
Co-authored-by: bcluap <bcluap@gmail.com>
Co-authored-by: Paul Carter-Brown <paul.carter-brown@jini.guru>
Co-authored-by: Ron Sigal <rsigal@redhat.com>
Co-authored-by: Ken Finnigan <ken@kenfinnigan.me>
Co-authored-by: rmartinc <rmartinc@redhat.com>
Co-authored-by: Roberto Cortez <radcortez@yahoo.com>
Co-authored-by: a.koshkin <a.koshkin@tinkoff.ru>
asoldano pushed a commit that referenced this pull request Sep 18, 2020
- Avoid unnecessary use of URI.create - rather do more lazily
- Multivalued maps will 99% of the time have 1 or maybe 2 entries for a key so don't allocate memory for 10
- Avoid unnecessary matcher creation when decoding when a string does not contain % in it - which is the more likely case for URI's to Rest resources

These changes increase throughput by about 2% on a simple Rest service.

Co-authored-by: Paul Carter-Brown <paul.carter-brown@jini.guru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants