Omit cookie spec registry when cookie management is disabled#645
Merged
rschmitt merged 1 commit intoapache:masterfrom Jun 5, 2025
Merged
Omit cookie spec registry when cookie management is disabled#645rschmitt merged 1 commit intoapache:masterfrom
rschmitt merged 1 commit intoapache:masterfrom
Conversation
The HTTP client builders always construct a client with a non-null
cookie spec registry; if a custom instance is not specified, then the
builders will use `CookieSpecSupport.createDefault()`, which loads the
full public suffix list. The PSL rules are stored on the heap as a
`ConcurrentHashMap`, i.e. a giant array (16,384 on my machine)
containing map entries, each of which is also allocated as a separate
object on the heap. This is a considerable number of live objects that
the garbage collector may need to trace. I ran a simple microbenchmark
to show the effects of loading the PSL on garbage collection (these
numbers are from JDK 1.8):
GC took 2 ms
GC took 2 ms
GC took 2 ms
Loading public suffix list... done (took 193 ms)
GC took 11 ms
GC took 8 ms
GC took 7 ms
This is potentially a significant amount of tail latency for use cases
that don't require cookie management, such as RPC calls. With this
change, it is now simpler to configure and construct a client that does
not load the PSL into memory.
Member
|
@rschmitt — shouldn’t we apply the same change to |
ok2c
approved these changes
Jun 5, 2025
|
👍 but in most cases the full public suffix list will be loaded by |
Contributor
Author
|
@PascalSchumacher I think this is the wrong default behavior and I plan on dealing with it next. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The HTTP client builders always construct a client with a non-null cookie spec registry; if a custom instance is not specified, then the builders will use
CookieSpecSupport.createDefault(), which loads the full public suffix list. The PSL rules are stored on the heap as aConcurrentHashMap, i.e. a giant array (16,384 on my machine) containing map entries, each of which is also allocated as a separate object on the heap. This is a considerable number of live objects that the garbage collector may need to trace. I ran a simple microbenchmark to show the effects of loading the PSL on garbage collection (these numbers are from JDK 1.8):This is potentially a significant amount of tail latency for use cases that don't require cookie management, such as RPC calls. With this change, it is now simpler to configure and construct a client that does not load the PSL into memory.