Class ShardMovementWriteLoadSimulator

java.lang.Object
org.elasticsearch.cluster.routing.ShardMovementWriteLoadSimulator

public class ShardMovementWriteLoadSimulator extends Object
Simulates the impact to each node's write-load in response to the movement of individual shards around the cluster.
  • Constructor Details

    • ShardMovementWriteLoadSimulator

      public ShardMovementWriteLoadSimulator(RoutingAllocation routingAllocation)
  • Method Details

    • simulateShardStarted

      public void simulateShardStarted(ShardRouting shardRouting)
    • simulatedNodeUsageStatsForThreadPools

      public Map<String,NodeUsageStatsForThreadPools> simulatedNodeUsageStatsForThreadPools()
      Apply the simulated shard movements to the original thread pool usage stats for each node.
    • updateNodeUtilizationWithShardMovements

      public static float updateNodeUtilizationWithShardMovements(float nodeUtilization, float shardWriteLoadDelta, int numberOfWriteThreads)
      The nodeUtilization is the average utilization per thread for some duration of time. The shardWriteLoadDelta is the sum of shards' total execution time. Dividing the shards total execution time by the number of threads provides the average utilization of each write thread for those shards. The change in shard load can then be added to the node utilization.
      Parameters:
      nodeUtilization - The current node-level write load percent utilization.
      shardWriteLoadDelta - The change in shard(s) execution time across all threads. This can be positive or negative depending on whether shards were moved onto the node or off of the node.
      numberOfWriteThreads - The number of threads available in the node's write thread pool.
      Returns:
      The new node-level write load percent utilization after adding the shard write load delta.
    • adjustThreadPoolQueueLatencyWithShardMovements

      public static long adjustThreadPoolQueueLatencyWithShardMovements(long maxThreadPoolQueueLatencyMillis, boolean hasSeenMovedAwayShard)
      Adjust the max thread pool queue latency by accounting for whether shard has moved away from the node.
      Parameters:
      maxThreadPoolQueueLatencyMillis - The current max thread pool queue latency.
      hasSeenMovedAwayShard - Whether the node has seen a shard move away from it.
      Returns:
      The new adjusted max thread pool queue latency.