I am trying to create simple script to set a node as draining, then remove the node after all connections are gone.
I am able to add, remove nodes, set the draining, but cant figure out how to test draining has been completed.
Of course I can set up a time out for a minute or so after node is set to drain, but that doesn't feel efficient.
I was also looking at getAllConnections() - but that is not really usable as our system is swamped with many connections and result is way to big to use it for periodical checking.
Solved! Go to Solution.
On the System.stats object you will find a getNodeCurrentConn( nodes ) method which might be your best option. It will show you how many TCP connections remain open to the node (including idle ones).
Alternatively you could use the getNodeTotalConn(nodes) method which will give you the number of requests sent to the node. If you check this number every x minutes until it stops increasing you will be able to detect when it has become idle.