How are the shard leaders distributed across nodes in YugabyteDB?

  1. And is there some metrics exported or way to verify what the leader counts is in each node overall as well as per table?

  2. For multi-region installations, Google Cloud Spanner (Informazioni sulle istanze  |  Cloud Spanner  |  Google Cloud) has a notion of a “default leader” for performance reasons, and recommends < Place the bulk of your read and write workloads in the default leader region. >. Does YugabyteDB have a similar notion and if so, how is this specified?

hi @busybruner

  1. Tablet (shard) leaders in YugabyteDB are distributed as evenly as possible across yb-tserver nodes. This helps spread read/write workloads because tablet leaders are consulted for writes and reads.

  2. Currently we expose tablet leader/followers on the yb-master UI. We can see the overall tablet counts on http://<any-yb-master-ip>:7000/tablet-servers.

While tablet specific leaders/followers for each table are displayed on the ui in http://<any-tserver-ip>:9000/tablets url of each yb-tserver.

  1. Yes, YugabyteDB supports the ability to specify preferred zone/regions(s) for the leaders. This can be done with set_preferred_zones 1 command in yb-admin cli. As long nodes are alive and healthy all tablet leaders will reside in that region/zone.
1 Like

@busybruner please see edited reply above