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

Todd Nine commented on USERGRID-527:
------------------------------------

See the email from Rafal.  I think we should mock this up via Junit, so that we 
can assert our routing works correctly.


Hello Todd,

As promised, I'm sending the hashing. Elasticsearch 1.x uses DjbHash:

https://github.com/elastic/elasticsearch/blob/1.5/src/main/java/org/elasticsearch/cluster/routing/operation/hash/djb/DjbHashFunction.java

The routing logic is in the PlainOperationRouting:

https://github.com/elastic/elasticsearch/blob/1.5/src/main/java/org/elasticsearch/cluster/routing/operation/plain/PlainOperationRouting.java

The interesting method is starting on line 265:

private int shardId(ClusterState clusterState, String index, String type, 
@Nullable String id, @Nullable String routing)

In Elasticsearch 2.0 things will be a bit different:

https://github.com/elastic/elasticsearch/blob/master/src/main/java/org/elasticsearch/cluster/routing/OperationRouting.java

You are interested in method:

private int shardId(ClusterState clusterState, String index, String type, 
String id, @Nullable String routing)

starting at line 250. In 2.0 Elasticsearch does hash calculations
using implementation of
org.elasticsearch.cluster.routing.HashFunction. The available
implementations will be:
 * org.elasticsearch.cluster.routing.SimpleHashFunction
 * org.elasticsearch.cluster.routing.Murmur3HashFunction
 * org.elasticsearch.cluster.routing.DjbHashFunction

The default hash function will be switched to Murmur hash.

> Write external ES test to ensure we get even routing across the ES cluster
> --------------------------------------------------------------------------
>
>                 Key: USERGRID-527
>                 URL: https://issues.apache.org/jira/browse/USERGRID-527
>             Project: Usergrid
>          Issue Type: Story
>            Reporter: Jeffrey 
>            Priority: Critical
>
> One of the problems we have faced is uneven distribution in the ES cluster.  
> We have made changes for document routing that seemed to help, but we are 
> still getting hot nodes in the cluster.  We need to have a test that hits ES 
> directly with load as UG would do to test our cluster distribution.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to