static void tryFreeController(List<ProxyNode> proxyNodes, double avg) {
        for (ProxyNode controller : proxyNodes) {
            if (!isController(controller.node.id())) {
                continue;
            }
            for (int i = 0; i < controller.mainNodeIds.size(); i++) {
                int mainNodeId = controller.mainNodeIds.get(i);
                if (isController(mainNodeId)) {
                    continue;
                }
                L1:
                for (ProxyNode switchNode : proxyNodes) {
                    if (switchNode.node.id() == controller.node.id() || isController(switchNode.node.id())) {
                        continue;
                    }
                    // move the main node to the switch node
                    if (switchNode.mainNodeIds.size() < avg) {
                        controller.mainNodeIds.remove(i);
                        switchNode.mainNodeIds.add(mainNodeId);
                        i--;
                        break;
                    } else {
                        // swap the main node with the switch node's main node(controller)
                        for (int j = 0; j < switchNode.mainNodeIds.size(); j++) {
                            int switchNodeMainNodeId = switchNode.mainNodeIds.get(j);
                            if (!isController(switchNodeMainNodeId)) {
                                continue;
                            }
                            controller.mainNodeIds.set(i, switchNodeMainNodeId);
                            switchNode.mainNodeIds.set(j, mainNodeId);
                            break L1;
                        }
                    }
                }
            }
        }
    }
Try to move the traffic from controller to broker.
- Let main node(controller) proxied by proxy node(controller).
- Let proxy node(controller) proxy less main node if possible.
core/src/main/java/kafka/automq/zerozone/ProxyNodeMapping.java