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

SOLR-17419: Introduce ParallelHttpShardHandler #2681

Merged

Conversation

gerlowskija
Copy link
Contributor

@gerlowskija gerlowskija commented Aug 29, 2024

https://issues.apache.org/jira/browse/SOLR-17419

Description

The default ShardHandler implementation, HttpShardHandler, sends all shard-requests serially, only parallelizing the waiting and parsing of responses. This works great for collections with few shards, but as the number of shards increases the serialized sending of shard-requests adds a larger and larger overhead. This is especially stark when auth is enabled, and PKI header-generation happens at request-sending time.

Solution

This commit fixes this by introducing an alternate ShardHandler implementation, geared towards collections with many shards. This ShardHandler uses an executor to parallelize both request sending and response waiting/parsing. This consumes more CPU, but reduces greatly reduces the latency/QTime observed by users querying many-shard collections.

See the perf-test results shared on SOLR-17149 for more details!

Tests

Consolidates two related test files into the single TestShardHandlerFactory, and adds randomization to cover the new ParallelSHF implementation.

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide

The default ShardHandler implementation, HttpShardHandler, sends all
shard-requests serially, only parallelizing the waiting and parsing of
responses.  This works great for collections with few shards, but as the
number of shards increases the serialized sending of shard-requests adds
a larger and larger overhead to the overall request (especially when
auth and PKI are done at request-sending time).

This commit fixes this by introducing an alternate ShardHandler
implementation, geared towards collections with many shards.  This
ShardHandler uses an executor to parallelize both request sending and
response waiting/parsing.  This consumes more CPU, but reduces greatly
reduces the latency/QTime observed by users querying many-shard
collections.

Remaining TODOs:
  - tests for ParallelHttpShardHandler
  - precommit/check
  - Javadocs
  - ref-guide docs for shard handler abstraction
  - test randomization for http vs parallel SH
@gerlowskija gerlowskija changed the title SOLR-17149: Introduce ParallelHttpShardHandler SOLR-17419: Introduce ParallelHttpShardHandler Aug 30, 2024
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Aug 30, 2024
@github-actions github-actions bot added the tests label Sep 5, 2024
@gerlowskija gerlowskija merged commit eeeb0e3 into apache:main Sep 6, 2024
3 checks passed
@gerlowskija gerlowskija deleted the SOLR-17149-parallel-shard-handling branch September 6, 2024 16:01
gerlowskija added a commit that referenced this pull request Sep 6, 2024
The default ShardHandler implementation, HttpShardHandler, sends all
shard-requests serially, only parallelizing the waiting and parsing of
responses.  This works great for collections with few shards, but as the
number of shards increases the serialized sending of shard-requests adds
a larger and larger overhead to the overall request (especially when
auth and PKI are done at request-sending time).

This commit fixes this by introducing an alternate ShardHandler
implementation, geared towards collections with many shards.  This
ShardHandler uses an executor to parallelize both request sending and
response waiting/parsing.  This consumes more CPU, but reduces greatly
reduces the latency/QTime observed by users querying many-shard
collections.
@psalagnac
Copy link
Contributor

psalagnac commented Sep 10, 2024

@gerlowskija I think the Jira item is wrong (SOLR-17419 vs SOLR-17149).
Mostly, I think it is worth to fix it in the CHANGES.txt file.

[EDIT] Oh actually the CHANGE file is correct. I was confused because this PR got linked to another Jira. Sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:search configs documentation Improvements or additions to documentation tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants