opamp-go
opamp-go copied to clipboard
Add Close() to types.Connection to allow the server to close a connection
It can be useful to close an agent connection to the server and I propose that a Close() method be added to the types.Connection interface.
The agent may quickly reconnect, but in a server cluster with multiple nodes, periodically closing connections can help with rebalancing the cluster.
Consider the case of 100 agents connected to a 2-node cluster and assume a load balancer splits them 50/50 between the 2 nodes. If one node is terminated, 50 agents will reconnect and now all 100 agents will be connected to a single node. If a node is added, there will still be 100 agents connected to a single node and the new node will have 0 agents.