This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Kafka } from 'kafkajs'; | |
import { hrtime } from 'node:process'; | |
// This script measures the performance impact of prefetching topic metadata before sending events. | |
// More specifically, the script measures how long each `send` call takes while it iterates through thousands of topics and sends an event to each. | |
// If PREFETCH is set to true, the script prefetches the metadata for each topic the cluster hosts before sending the events. | |
// The measurement results are output in CSV format and can be easily visualized with e.g. rawgraphs.io | |
// --- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { hrtime } from 'node:process'; | |
import { Kafka } from 'kafkajs'; | |
// --- | |
const CLUSTER_URL = 'localhost:9092'; | |
const TOPIC_COUNT = 3500; | |
const TPS = 25; | |
const REPORT_WINDOW_S = 1; | |
const TEST_DURATION_S = 60; |