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

ArrayTernaryTrie consumes too much memory #5562

Closed
leonchen83 opened this issue Nov 3, 2020 · 3 comments · Fixed by #5565
Closed

ArrayTernaryTrie consumes too much memory #5562

leonchen83 opened this issue Nov 3, 2020 · 3 comments · Fixed by #5565

Comments

@leonchen83
Copy link
Contributor

Jetty version
9.4.x
Java version
java 11
OS type/version
centos 7
Description
ArrayTernaryTrie consume 17% memory.
image

more details please see following chart
advance01-20201103-instanceorder.zip

@gregw
Copy link
Contributor

gregw commented Nov 3, 2020

Tries are currently being reviewed as part of #5291

@gregw
Copy link
Contributor

gregw commented Nov 3, 2020

Note also that there is a per connection header cache, so that if you have lots of short lived connections, then you may allocated a lot of caches for no reason.
You can configure the cache with HttpConfiguration.setHeaderCacheSize(int) method or the jetty.httpConfig.headerCacheSize property.

I'll also have a look to see if we can be smarter about when we create this cache.

gregw added a commit that referenced this issue Nov 3, 2020
Fix #5562 by initially putting cacheable fields into a inexpensive arraylist.
Only create the Trie (with space and complexity costs) if a second request is received.
@gregw gregw linked a pull request Nov 3, 2020 that will close this issue
@gregw gregw changed the title ArrayTernaryTrie consume too many memory ArrayTernaryTrie consumes too much memory Nov 3, 2020
@gregw
Copy link
Contributor

gregw commented Nov 3, 2020

See #5565 as an alternative to disabling the HttpField cache. This PR will change the parser to only create the cache on a second request.

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 a pull request may close this issue.

2 participants