Skip to content

CookieStore slows down with increasing number of cookies #1580

Closed
@joshovi

Description

@joshovi

In

List<Cookie> result = cookieJar.entrySet().stream().filter(pair -> {
the look up over cookies traverses all entries in the map. The side effect to clean all expired cookies traverses the list again. The cost for algorithm scales with the number of cookies.

In our project we had to disable the cookie store, i.e.
new DefaultAsyncHttpClientConfig.Builder() .setCookieStore(null) ... .build()

Maybe you could rewrite the function using another data structure that facilitates the look up for candidate cookies and then make a lazy removal of the expired candidates, or remove expired cookies asynchronously and periodically.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions