git.frostfs.info/TrueCloudLab/frostfs-sdk-go@v0.0.0-20241022124111-5361f0ecebd3/doc/pool.md (about) 1 # Node connection pool 2 3 * Distributes requests between fixed number of nodes 4 * Wraps 5 6 The distribution between nodes in connection pool is based on priority and weight parameters from 7 NodeParam struct. The distribution model is presented below. On this scheme nodes with the same 8 priority have the same color. 9 10  11 12 ## Priority 13 14 Pool component forwards request to the nodes with the highest priority (the lower the value - 15 the higher the priority). The `node 1` from the image's scenario (I) is healthy 16 and has the highest priority (1), that's why the pool forwards requests from it. There are no other 17 nodes with priority 1, so `node 1` receives all requests. In the second scenario (II) `node 1` 18 becomes unhealthy. In that case pool tries to connect nodes with next in priority nodes e.g. 19 `Node 4` and `node 2`. If all of them become unhealthy too, the pool sends requests to nodes with 20 priority 3 in scenario (III) and so on. 21 22 ## Weights 23 24 If there are several nodes with the same priority, then requests are distributed randomly between 25 these nodes based on their weights. To do that the proportion of weights is calculated. 26 For example, for `node 2` and `node 4` with weights 2 and 8 the distribution would be 20 and 80 percent 27 respectively.