[ 
https://issues.apache.org/jira/browse/SOLR-13257?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16769617#comment-16769617
 ] 

Michael Gibney edited comment on SOLR-13257 at 2/15/19 7:25 PM:
----------------------------------------------------------------

The attached standalone java class provides users the option to configure 
replica routing affinity by configuring their {{requestHandler}} with:

{code:xml}
    <shardHandlerFactory class="AffinityShardHandlerFactory">
      <str name="routingParam">routingHash</str>
      <str name="hashParam">q</str>
    </shardHandlerFactory>
{code}

The {{routingParam}} allows the user to specify a parameter that will be used 
to select a replica by {{routingValIntHash % replicationFactor}}. In the 
absence of a {{routingParam}} parameter in the request, the request parameter 
configured for {{hashParam}} is used to determine replica routing. 

The special value {{DISABLE_DETERMINISTIC_ROUTING}} may be passed as the value 
of the configured {{routingParam}} query parameter to explicitly fallback to 
default (random) replica routing.


was (Author: mgibney):
The attached standalone java class provides users the option to configure 
replica routing affinity by configuring their {{requestHandler}} with:

{code:xml}
    <shardHandlerFactory class="AffinityShardHandlerFactory">
      <str name="routingParam">routingHash</str>
      <str name="hashParam">q</str>
    </shardHandlerFactory>
{code}

The {{routingParam}} allows the user to specify a parameter that will be used 
to select a replica by {{routingValIntHash % replicationFactor}}. In the 
absence of a {{routingParam}} parameter in the request, the request parameter 
configured for {{hashParam}} is used to determine replica routing. 

The special value `DISABLE_DETERMINISTIC_ROUTING` may be passed as the value of 
the configured {{routingParam}} query parameter to explicitly fallback to 
default (random) replica routing.

> Enable replica routing affinity for better cache usage
> ------------------------------------------------------
>
>                 Key: SOLR-13257
>                 URL: https://issues.apache.org/jira/browse/SOLR-13257
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: SolrCloud
>    Affects Versions: 7.4, master (9.0)
>            Reporter: Michael Gibney
>            Priority: Major
>         Attachments: AffinityShardHandlerFactory.java
>
>
> For each shard in a distributed request, Solr currently routes each request 
> randomly via 
> [ShufflingReplicaListTransformer|https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/handler/component/ShufflingReplicaListTransformer.java]
>  to a particular replica. In setups with replication factor >1, this normally 
> results in a situation where subsequent requests (which one would hope/expect 
> to leverage cached results from previous related requests) end up getting 
> routed to a replica that hasn't seen any related requests.
> The problem can be replicated by issuing a relatively expensive query (maybe 
> containing common terms?). The first request initializes the 
> {{queryResultCache}} on the consulted replicas. If replication factor >1 and 
> there are a sufficient number of shards, subsequent requests will likely be 
> routed to at least one replica that _hasn't_ seen the query before. The 
> replicas with uninitialized caches become a bottleneck, and from the client's 
> perspective, many subsequent requests appear not to benefit from caching at 
> all.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to