What are the tunable options for mongos?

You can adjust the following options the mongos config file using the setParameter field. For example:
setParameter:
   ShardingTaskExecutorPoolMaxSize: 100
   ShardingTaskExecutorPoolMinSize: 25
   ShardingTaskExecutorPoolHostTimeoutMS: 1800000
Note
mongos can maintain multiple pools of threads. If you set max connections to 100 and you have 4 executor threads, each executor thread has a connection pool per node for a maximum of 400 connections to a specific node.
For more information, see Sharding Parameters.

taskExecutorPoolSize

The number of connection pools to use for a given mongos.
  • Defaults to the number of available cores (min 4, max 64).
  • Set to a lower value to reduce the number of open connections in the system. This may cause some performance loss under heavier loads.
  • The default setting is usually appropriate. On severs with a large number of cores, it may be beneficial to set this option to 16 or less.

ShardingTaskExecutorPoolHostTimeoutMS

Maximum time that mongos goes without communication to a host before mongos drops all connections to the host.
  • Default is 300000 (5 minutes).
  • Longer timeouts smooth connection spikes. Setting this to 3-4x the period of the connection spikes generally prevents the need for reconnection.

ShardingTaskExecutorPoolMaxSize

Maximum number of outbound connections each TaskExecutor connection pool can open to any given mongod instance.
  • Default is unlimited, but the maximum possible connections to any given host across all TaskExecutor pools is ShardingTaskExecutorPoolMaxSize * taskExecutorPoolSize.
  • It may be beneficial to set a limit for this value if some mongod servers in your deployment are experiencing connection floods.

ShardingTaskExecutorPoolMinSize

Minimum number of outbound connections each TaskExecutor connection pool can open to any given mongod instance.
  • Default is 1.
  • It may be beneficial to increase this value if a system is experiencing latency issues due to cold starts.
  • The drawback to increasing this value is that the mongos process keeps these sessions open (TaskExecutorPoolSize * PoolMinSize * NUM_MONGOS per shard) until the ShardingTaskExecutorPoolHostTimeoutMS expires.

ShardingTaskExecutorPoolRefreshRequirementMS

Maximum time a mongos waits before attempting to heartbeat a resting connection in the pool.
  • Default is 60000 (1 minute).
  • The default setting is appropriate for most deployments.
  • Raising this number increases heartbeat traffic, which increases idle load.
  • Lower values may reduce the number of transient network failures seen in a system because non-user operations see them earlier and transparently re-connect.

ShardingTaskExecutorPoolRefreshTimeoutMS

Maximum time a mongos waits for a heartbeat before timing out the heartbeat.
  • Default 20000 (20 seconds).
  • If this value is too low, the mongos cannot maintain connections in the pool.
  • In scenarios with high network latency, increasing this value may improve retention of network connections.

Comments

  1. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Where we can see default values of these params in our mongo server

      Delete

Post a Comment