-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BALANCER] 比較網路的優化效果 #1823
Comments
這邊敘述建立情境的方法 建立叢集下載下面這個檔案,解壓縮後裡面有一個序列化後的 ClusterInfo 用 Astraea 專案內的 library 可以反序列化裡面的資訊,之後要將裡面描述的叢集套用到一個 6 節點的 Kafka Cluster,其中每個節點 ID 必須要是 0,1,2,3,4,5。 下面是一個套用的範例程式碼 @Test
void restoreClusterInfo() throws IOException {
var file = "/path/to/exp2-cluster-info-before-greedy.bin";
try (
var admin = Admin.of(bootstrap);
var stream = Files.newInputStream(Path.of(file))) {
var cluster = ByteUtils.readClusterInfo(stream.readAllBytes());
System.out.println("Delete Topics");
admin.topicNames(false)
.thenApply(x -> x.stream()
.filter(xx -> !xx.startsWith("__"))
.collect(Collectors.toSet()))
.thenApply(x -> {
System.out.println("Delete: " + x);
return x;
})
.thenCompose(admin::deleteTopics)
.toCompletableFuture()
.join();
Utils.sleep(Duration.ofSeconds(10));
System.out.println("Recreate Topics");
cluster.replicas().stream()
.collect(Collectors.groupingBy(Replica::topic, Collectors.mapping(Replica::topicPartition, Collectors.counting())))
.entrySet()
.stream()
.map(x -> admin.creator()
.topic(x.getKey())
.numberOfPartitions(x.getValue().intValue())
.numberOfReplicas((short)1)
.run()
.toCompletableFuture())
.toList()
.forEach(CompletableFuture::join);
System.out.println("Relocate Replicas");
admin.moveToBrokers(cluster.topicPartitions()
.stream()
.collect(Collectors.toUnmodifiableMap(
tp -> tp,
tp -> cluster.replicas(tp).stream()
.sorted(Comparator.comparing(x -> !x.isPreferredLeader()))
.map(Replica::brokerId)
.collect(Collectors.toList())
)))
.toCompletableFuture()
.join();
Utils.sleep(Duration.ofSeconds(5));
System.out.println("Relocate to Folders");
admin.moveToFolders(cluster.replicas()
.stream()
.collect(Collectors.toUnmodifiableMap(Replica::topicPartitionReplica, Replica::path)))
.toCompletableFuture()
.join();
Utils.sleep(Duration.ofSeconds(5));
System.out.println("Leader election");
admin.preferredLeaderElection(cluster.topicPartitions());
Utils.sleep(Duration.ofSeconds(5));
admin.topicNames(true)
.thenCompose(admin::clusterInfo)
.toCompletableFuture()
.join()
.replicas()
.stream()
.filter(x -> x.isFuture() || x.isAdding() || x.isRemoving())
.forEach(System.out::println);
}
} 建立 Producer & Consumerexp2-ansible.txt 每個欄位會對應到 Performance Tool 的參數
流量的趨勢完成上述步驟後叢集會有這樣的流量趨勢: 節點的輸入 節點的輸出 如果趨勢不符合的話代表有地方重現失敗 |
想請教一下具體要比較的話,我們打算怎麼處理呢? |
Hi @brandboat, 我平常比較的方法是,以比較 A 方法和 B 方法的好壞為例:
用 5 和 8 得到的數據去寫出比較的結論:在 xyz 硬體和 2 的情境下,方法 A 和 方法 B 有著 ... 結論。 |
比較 Balancer 的優化效果
The text was updated successfully, but these errors were encountered: