private static void renderUpstreamsTo(StringBuilder sb, RoutingTable routingTable, RoutingStatus routingStatus) {
        Map<Real, RoutingTable.Target> realTable = new HashMap<>();
        for (var target : routingTable.asMap().values()) {
            if (target.applicationLevel()) continue;
            for (var real : target.reals()) {
                realTable.put(real, target);
            }
        }
        routingTable.asMap().values().stream().sorted().distinct().forEach(target -> {
            sb.append("upstream ").append(target.id()).append(" {").append("\n");

            // Check if any target is active.
            for (var real : target.reals()) {
                boolean explicitRoutingActive = true;
                // Check external status service if this is an application-level target
                if (target.applicationLevel()) {
                    RoutingTable.Target targetOfReal = realTable.get(real);
                    explicitRoutingActive = routingStatus.isActive(targetOfReal.id());
                }
                String serverParameter = serverParameter(target, real, explicitRoutingActive);
                sb.append("  server ").append(real.hostname()).append(":4443").append(serverParameter).append(";\n");
            }
            int healthCheckPort = 4082;
            sb.append("  ").append(checkDirective(healthCheckPort)).append("\n");
            sb.append("  ").append(checkHttpSendDirective(target.id())).append("\n");
            sb.append("  random two;\n");
            sb.append("}\n\n");
        });
    }
Converts a {@link RoutingTable} to Nginx's own config format.

@author Martin Polden
routing-generator/src/main/java/com/yahoo/vespa/hosted/routing/nginx/NginxConfig.java