Documentation

Package

On this page

Benchmarks

How @cookiemonsterdev/kafka-core compares with @platformatic/kafka, kafkajs and @confluentinc/kafka-javascript on Node.js 24, Node.js 26 and Bun. The headline workload sends 1 KiB values with a key and headers. A second workload with 100 B values is a stress test of per-record client overhead. Each table shows both side by side.

Read this first

  • The 100 B results stress per-record client overhead: with little data per record, they rank clients mostly by the work each does per record. The 1 KiB results are the headline.
  • Only kafka-core verifies record-batch CRCs while consuming, so it does extra work in the consume and latency results.
  • Concurrent sends favour clients that merge separate send() calls into one batch, as kafka-core does. Batched send is the fairer produce comparison.
  • Confluent’s client runs on Node.js 24 only. Its consume runs can run out of memory under the 2 GiB limit: a median covers the runs that finished, and a cell where every run failed has no value.
  • All results come from one machine. Treat small differences as inconclusive.
  • A chart names the highest or lowest client on a runtime only when that client’s runs separate from each other client’s beyond noise: neither client’s runs are noisy, their min–max ranges do not overlap, and their medians differ by more than the noise floor. Otherwise it says there is no clear highest or lowest. The comparison rule has the details.

Setup

Payloads

Payload Role Key Value Headers
1 KiB Headline 16 B 1,024 B 2, 16 B values
100 B Per-record overhead stress test 16 B 100 B none

Records come from a fixed seed, so every client sends the same bytes in every session. Produce scenarios send the key, value and headers. Consume topics are seeded by Kafka’s own kafka-producer-perf-test.sh with values only. The first record of each pool:

1 KiB payload
  key:     oaiAFEM45BqQZohS
  value:   nllFj3ggk3mU784jQBEVmfvfoz3jIThm… (1,024 bytes)
  headers: h0=vQxYM0LwifDiUhLJ, h1=CWvHUVtzHWRmW1r0

100 B payload
  key:     oaiAFEM45BqQZohS
  value:   nllFj3ggk3mU784jQBEVmfvfoz3jIThm… (100 bytes)
  headers: none

Record counts

Each run sends or reads its warm-up records first and measures only the rest. Measured time is the median time of the fastest and of the slowest client and runtime under the normalized profile; E1 instead runs for its fixed duration, and L1 times one record from process start. Every run gets a fresh topic with 3 partitions, deleted before the next run starts.

Scenario 1 KiB measured records 1 KiB warm-up 1 KiB measured time 100 B measured records 100 B warm-up 100 B measured time
P1 produce-single 7,500 500 0.5–0.8 s 30,000 2,000 2.1–3.1 s
P2 produce-batch 1,200,000 60,000 2.0–10.4 s 500,000 20,000 0.6–2.6 s
P3 produce-throughput 250,000 12,500 0.6–12.1 s 1,000,000 50,000 1.9–46.8 s
C1 consume-each-message 500,000 12,500 0.3–3.5 s 2,000,000 50,000 0.5–1.9 s
C2 consume-each-batch 500,000 12,500 0.3–3.4 s 2,000,000 50,000 0.4–1.1 s
E1 e2e-latency 5,000/s for 15 s 5,000 — 5,000/s for 15 s 5,000 —
L1 startup 1 0 — 1 0 —

Wire settings

The normalized profile pins these settings for every client; each adapter maps them to its own options. The library-defaults chart sets only brokers, client id and group id.

Scenario Produce calls Acks Linger Batch size Max in-flight Compression Idempotent
P1 produce-single sequential send() of 1 record 1 0 ms 16 KiB 5 none no
P2 produce-batch sequential send() of 100 records 1 0 ms 16 KiB 5 none no
P3 produce-throughput up to 256 concurrent send() calls of 1 record 1 5 ms 16 KiB 5 none no
E1 e2e-latency one record per send() at a fixed rate 1 0 ms 16 KiB 5 none no
L1 startup one record 1 0 ms 16 KiB 5 none no
Scenario Consume handler Fetch min Fetch max Partition fetch max Fetch max wait
C1 consume-each-message per record 1 B 50 MiB 1 MiB 100 ms
C2 consume-each-batch batch 1 B 50 MiB 1 MiB 100 ms
E1 e2e-latency per record 1 B 50 MiB 1 MiB 100 ms
L1 startup per record 1 B 50 MiB 1 MiB 100 ms

Environment

Every container runs on one Docker VM, each pinned to its own CPUs. Scenarios, fairness rules and the option mapping of each client are in the benchmarks README.

Setting 1 KiB 100 B
Session 20261116193938-e9d9dad43d38, standard tier, count scale 1 20261113170453-7a9308c82c8d, standard tier, count scale 1
Date 2026-11-16 2026-11-13
Repetitions 5, interleaved 5, interleaved
Clients kafka-core 2.8.1 (e9d9dad43d38), Platformatic 2.15.0, KafkaJS 2.2.4 and Confluent 1.11.0 kafka-core 2.7.0 (7a9308c82c8d), Platformatic 2.15.0, KafkaJS 2.2.4 and Confluent 1.11.0
Runtimes Node.js 24.22.3, Node.js 26.13.1 and Bun 1.4.4 Node.js 24.22.3, Node.js 26.13.1 and Bun 1.4.4
Host Apple M5, 10 CPUs, 32 GiB, darwin 27.2.0 arm64 Apple M5, 10 CPUs, 32 GiB, darwin 27.2.0 arm64
Docker VM Docker 29.9.2, 6 vCPUs, 9.7 GiB Docker 29.9.2, 6 vCPUs, 9.7 GiB
Broker apache/kafka:4.3.2, one KRaft node; 3 vCPUs (cpuset 0-2), 5 GiB memory, 2 GiB heap, 2 GiB tmpfs log apache/kafka:4.3.2, one KRaft node; 3 vCPUs (cpuset 0-2), 5 GiB memory, 2 GiB heap, 2 GiB tmpfs log
Client container 2 vCPUs (cpuset 3-4), 2 GiB memory, swap off; a fresh container per run 2 vCPUs (cpuset 3-4), 2 GiB memory, swap off; a fresh container per run

Produce

Batched send (100 records)

Each call awaits send() of 100 records with acks 1. This is the fairest produce comparison.

Runtime Client 1 KiB median (records/s) 1 KiB min–max 100 B median (records/s) 100 B min–max
Node.js 24 kafka-core 500,318 479,559–517,470 733,362 681,607–765,436
Node.js 24 Platformatic 308,775 305,387–314,984 481,179 475,129–496,476
Node.js 24 KafkaJS 118,211 112,882–119,021 296,860 295,266–306,519
Node.js 24 Confluent 138,936 135,063–140,816 195,811 186,537–202,238
Node.js 26 kafka-core 516,371 485,397–526,124 739,793 634,252–783,589
Node.js 26 Platformatic 335,248 330,443–341,872 514,220 493,928–549,394
Node.js 26 KafkaJS 114,995 111,623–115,781 296,467 268,919–322,077
Node.js 26 Confluent not supported — not supported —
Bun kafka-core 590,022 578,675–593,585 862,926 704,688–881,261
Bun Platformatic 344,696 318,690–356,387 544,173 485,790–565,946
Bun KafkaJS 150,963 145,208–152,124 314,328 305,222–330,950
Bun Confluent not supported — not supported —

Single-record send

Each call awaits send() of one record with acks 1 and no linger, so every record waits for a broker round trip.

Runtime Client 1 KiB median (records/s) 1 KiB min–max 100 B median (records/s) 100 B min–max
Node.js 24 kafka-core 13,079 12,959–13,160 13,339 12,248–13,501
Node.js 24 Platformatic 12,849 11,742–12,942 13,660 12,102–14,194
Node.js 24 KafkaJS 11,098 10,848–11,237 12,955 12,401–13,038
Node.js 24 Confluent 9,418 9,376–9,600 9,693 8,165–9,723
Node.js 26 kafka-core 13,538 11,902–13,863 13,529 13,390–13,678
Node.js 26 Platformatic 13,121 12,361–13,333 13,879 11,785–14,239
Node.js 26 KafkaJS 11,718 11,601–11,796 13,252 12,485–13,443
Node.js 26 Confluent not supported — not supported —
Bun kafka-core 13,799 13,645–13,881 14,166 13,804–14,258
Bun Platformatic 13,349 12,535–13,383 14,505 12,652–14,669
Bun KafkaJS 11,435 11,274–11,689 12,506 11,396–13,422
Bun Confluent not supported — not supported —

Concurrent sends

Up to 256 concurrent single-record send() calls with linger 5 ms. This favours clients that merge separate calls into one batch, as kafka-core does.

Runtime Client 1 KiB median (records/s) 1 KiB min–max 100 B median (records/s) 100 B min–max
Node.js 24 kafka-core 343,000 332,094–351,983 463,803 446,837–480,548
Node.js 24 Platformatic 22,707 22,453–23,048 23,411 21,445–23,718
Node.js 24 KafkaJS 20,674 20,236–20,950 22,483 21,968–22,637
Node.js 24 Confluent 209,578 204,309–211,849 38,837 37,645–39,724
Node.js 26 kafka-core 363,729 362,065–371,515 473,203 467,563–501,351
Node.js 26 Platformatic 22,523 22,402–22,915 23,533 23,093–23,853
Node.js 26 KafkaJS 20,928 20,567–21,181 22,266 21,182–22,634
Node.js 26 Confluent not supported — not supported —
Bun kafka-core 426,673 415,886–430,839 539,965 519,937–598,291
Bun Platformatic 22,202 21,986–22,425 22,832 22,257–23,625
Bun KafkaJS 21,535 21,131–21,709 21,356 20,006–21,757
Bun Confluent not supported — not supported —

Consume

Per message

Reads 2,000,000 preloaded records with a per-record handler and the same fetch settings for every client.

Runtime Client 1 KiB median (records/s) 1 KiB min–max 100 B median (records/s) 100 B min–max
Node.js 24 kafka-core 1,546,497 1,371,066–1,624,131 2,891,376 2,689,068–3,082,460
Node.js 24 Platformatic 1,304,071 1,215,168–1,871,724 2,403,499 2,113,860–2,435,408
Node.js 24 KafkaJS 656,862 647,332–690,401 1,041,250 955,093–1,067,087
Node.js 24 Confluent 141,687 91,972–165,921 all 5 runs failed —
Node.js 26 kafka-core 1,620,671 1,471,845–1,675,648 2,869,724 2,677,893–3,262,341
Node.js 26 Platformatic 1,332,017 1,216,039–1,839,749 1,910,615 1,758,740–1,965,774
Node.js 26 KafkaJS 914,060 753,852–968,183 1,196,561 1,150,633–1,228,856
Node.js 26 Confluent not supported — not supported —
Bun kafka-core 1,687,369 1,643,485–1,750,280 4,151,819 3,641,230–4,255,847
Bun Platformatic 1,263,056 1,228,472–1,291,289 2,192,023 1,726,861–2,211,932
Bun KafkaJS 794,718 661,420–802,581 1,249,990 1,061,110–1,283,452
Bun Confluent not supported — not supported —

Per message, library defaults

The same read with each library’s default settings, including its own auto-commit.

Runtime Client 1 KiB median (records/s) 1 KiB min–max 100 B median (records/s) 100 B min–max
Node.js 24 kafka-core 1,315,700 1,313,028–1,342,494 2,757,695 2,566,987–2,815,374
Node.js 24 Platformatic 282,117 280,469–286,713 435,624 410,393–454,747
Node.js 24 KafkaJS 571,749 541,444–598,573 875,126 872,381–932,616
Node.js 24 Confluent 114,124 110,450–143,770 304,786 274,330–317,100
Node.js 26 kafka-core 1,420,746 1,373,598–1,512,895 2,706,047 2,355,671–3,322,178
Node.js 26 Platformatic 330,790 318,576–331,047 521,112 501,098–549,296
Node.js 26 KafkaJS 640,494 588,608–865,150 966,543 900,850–1,001,401
Node.js 26 Confluent not supported — not supported —
Bun kafka-core 1,604,841 1,564,988–1,647,654 4,144,651 3,760,056–4,351,322
Bun Platformatic 753,610 700,663–790,198 1,386,776 1,270,601–1,481,535
Bun KafkaJS 740,420 707,186–767,742 1,195,130 964,925–1,314,520
Bun Confluent not supported — not supported —

Batch

The same read through each client’s batch API. Platformatic has none, so its adapter emulates one.

Runtime Client 1 KiB median (records/s) 1 KiB min–max 100 B median (records/s) 100 B min–max
Node.js 24 kafka-core 1,673,172 1,503,964–1,705,861 4,270,240 3,480,759–4,528,435
Node.js 24 Platformatic 1,232,587 1,110,619–1,975,200 1,777,589 1,533,532–1,808,051
Node.js 24 KafkaJS 1,100,685 1,073,308–1,136,050 2,051,767 1,897,572–2,115,485
Node.js 24 Confluent 147,782 129,770–223,310 all 5 runs failed —
Node.js 26 kafka-core 1,735,931 1,582,447–1,862,525 4,261,174 3,375,953–4,498,085
Node.js 26 Platformatic 1,284,672 1,264,772–1,293,509 1,721,777 1,467,793–1,778,319
Node.js 26 KafkaJS 1,169,050 1,146,334–1,215,637 2,078,498 1,918,998–2,253,614
Node.js 26 Confluent not supported — not supported —
Bun kafka-core 1,792,575 1,726,949–1,805,928 5,559,484 5,425,961–5,568,039
Bun Platformatic 1,252,699 1,230,758–1,280,767 2,029,208 1,894,828–2,066,099
Bun KafkaJS 1,194,011 1,143,132–1,206,078 2,266,808 2,146,447–2,305,169
Bun Confluent not supported — not supported —

End-to-end latency

Median

A producer sends 5,000 records per second for 15 seconds while a consumer reads them. Latency runs from the scheduled send time to consumption.

Runtime Client 1 KiB median (ms) 1 KiB min–max 100 B median (ms) 100 B min–max
Node.js 24 kafka-core 1.42 1.35–1.57 1.42 1.39–1.67
Node.js 24 Platformatic 1.52 1.38–1.56 1.51 1.43–1.67
Node.js 24 KafkaJS 1.54 1.49–1.64 1.47 1.40–1.51
Node.js 24 Confluent 3.71 3.67–3.82 3.41 3.26–3.82
Node.js 26 kafka-core 1.45 1.42–1.54 1.44 1.41–1.73
Node.js 26 Platformatic 1.50 1.43–1.62 1.53 1.43–1.68
Node.js 26 KafkaJS 1.70 1.54–1.87 1.54 1.47–1.75
Node.js 26 Confluent not supported — not supported —
Bun kafka-core 1.06 1.05–1.07 1.03 1.02–1.09
Bun Platformatic 1.26 1.22–1.29 1.16 1.14–1.29
Bun KafkaJS 1.11 1.10–1.11 1.03 1.02–1.10
Bun Confluent not supported — not supported —

99th percentile

The same runs, 99th percentile.

Runtime Client 1 KiB median (ms) 1 KiB min–max 100 B median (ms) 100 B min–max
Node.js 24 kafka-core 3.30 3.04–3.33 3.29 2.70–3.79
Node.js 24 Platformatic 3.67 3.09–4.00 4.01 3.36–6.02
Node.js 24 KafkaJS 4.30 3.97–4.72 3.40 3.14–5.67
Node.js 24 Confluent 11.43 10.34–11.72 7.96 7.73–8.84
Node.js 26 kafka-core 3.27 3.16–3.30 3.31 2.71–26.06
Node.js 26 Platformatic 3.21 3.11–3.50 3.51 3.43–5.74
Node.js 26 KafkaJS 3.60 3.38–4.00 3.34 3.06–4.40
Node.js 26 Confluent not supported — not supported —
Bun kafka-core 2.15 2.06–2.36 2.88 2.33–6.01
Bun Platformatic 3.88 3.24–4.53 3.33 3.09–3.93
Bun KafkaJS 3.42 3.12–3.49 2.91 2.77–6.90
Bun Confluent not supported — not supported —

Startup

Time from process start to the first acknowledged produce.

Runtime Client 1 KiB median (ms) 1 KiB min–max 100 B median (ms) 100 B min–max
Node.js 24 kafka-core 92.6 90.7–95.1 85.6 77.4–89.6
Node.js 24 Platformatic 200.0 195.6–207.8 190.6 182.6–214.4
Node.js 24 KafkaJS 97.7 97.6–104.4 85.7 80.6–99.3
Node.js 24 Confluent 232.9 229.0–235.3 223.0 69.5–232.7
Node.js 26 kafka-core 81.2 77.7–87.7 80.7 79.0–99.7
Node.js 26 Platformatic 180.7 178.7–198.0 179.5 166.9–184.8
Node.js 26 KafkaJS 90.6 82.8–93.8 80.0 75.8–115.1
Node.js 26 Confluent not supported — not supported —
Bun kafka-core 50.1 49.0–53.1 50.9 50.3–60.8
Bun Platformatic 122.5 117.7–123.0 116.8 105.8–122.0
Bun KafkaJS 39.3 38.9–39.9 33.6 31.7–38.7
Bun Confluent not supported — not supported —

Peak memory

Batched send

Peak container memory during batched send, under a 2 GiB limit.

Runtime Client 1 KiB median (MiB) 1 KiB min–max 100 B median (MiB) 100 B min–max
Node.js 24 kafka-core 82 77–84 84 79–92
Node.js 24 Platformatic 145 143–163 108 99–112
Node.js 24 KafkaJS 178 169–179 93 87–94
Node.js 24 Confluent 106 96–111 68 58–70
Node.js 26 kafka-core 78 71–80 76 72–80
Node.js 26 Platformatic 105 100–110 97 95–99
Node.js 26 KafkaJS 121 117–127 89 86–93
Node.js 26 Confluent not supported — not supported —
Bun kafka-core 62 60–64 65 64–66
Bun Platformatic 111 108–115 83 83–86
Bun KafkaJS 77 70–85 58 56–66
Bun Confluent not supported — not supported —

Consume (per message)

Peak container memory while consuming per message, under a 2 GiB limit.

Runtime Client 1 KiB median (MiB) 1 KiB min–max 100 B median (MiB) 100 B min–max
Node.js 24 kafka-core 123 106–149 213 197–445
Node.js 24 Platformatic 180 122–191 228 222–234
Node.js 24 KafkaJS 152 150–163 215 211–225
Node.js 24 Confluent 806 447–1,532 all 5 runs failed —
Node.js 26 kafka-core 103 93–119 165 162–273
Node.js 26 Platformatic 138 130–149 201 196–215
Node.js 26 KafkaJS 119 114–132 161 157–163
Node.js 26 Confluent not supported — not supported —
Bun kafka-core 103 98–112 129 124–141
Bun Platformatic 168 162–179 172 162–174
Bun KafkaJS 115 111–130 150 144–158
Bun Confluent not supported — not supported —

Consume (batch)

Peak container memory while consuming in batches, under a 2 GiB limit.

Runtime Client 1 KiB median (MiB) 1 KiB min–max 100 B median (MiB) 100 B min–max
Node.js 24 kafka-core 150 113–176 208 204–215
Node.js 24 Platformatic 164 119–189 240 226–244
Node.js 24 KafkaJS 134 126–160 211 206–214
Node.js 24 Confluent 758 654–1,109 all 5 runs failed —
Node.js 26 kafka-core 110 98–115 161 149–166
Node.js 26 Platformatic 146 134–150 224 209–229
Node.js 26 KafkaJS 115 107–120 164 156–168
Node.js 26 Confluent not supported — not supported —
Bun kafka-core 98 96–119 134 131–141
Bun Platformatic 168 158–173 181 177–192
Bun KafkaJS 119 107–122 141 136–149
Bun Confluent not supported — not supported —

Install size

What installing each client adds, measured in the benchmark image. Required is the package and everything it reaches through dependencies; optional is what its optionalDependencies add, which npm and pnpm skip when they cannot be installed.

This is information, not a ranking, because size follows what each client implements and bundles: kafka-core implements KIP-848 consumer groups, KIP-932 share groups and transactions (see Compatibility), Platformatic and Confluent’s client implement KIP-848 and transactions but not share groups, KafkaJS implements transactions but neither KIP-848 nor share groups, and Confluent’s client bundles librdkafka as a native addon.

Client Version Required (MB) Required dependencies Required files Optional (MB) Optional dependencies Optional files Native addon
kafka-core 2.8.1 1.46 3 210 0.54 2 9 optional only
Platformatic 2.15.0 4.62 16 1,797 4.46 4 129 optional only
KafkaJS 2.2.4 0.73 0 391 0.00 0 0 no
Confluent 1.11.0 47.23 25 1,316 0.00 0 0 yes

MB is 1,000,000 bytes.

How to reproduce

From the repository root, with Docker running, run one session per payload. Regenerating the page from a session replaces only the results of its payload. A seed repeats the run order of the published session; record counts come from the current runner, so they can differ from the published ones listed under Record counts.

1 KiB values

pnpm benchmarks:run --tier standard --payload medium --seed 2119662096
pnpm docs:benchmarks --competitors benchmarks/results/raw/<session> --core benchmarks/results/raw/<session>

100 B values

pnpm benchmarks:run --tier standard --payload small --seed 4214559388
pnpm docs:benchmarks --competitors benchmarks/results/raw/<session> --core benchmarks/results/raw/<session>

Results from other hardware

Results hold as ratios on the machine that produced them. To contribute results from another machine, run pnpm benchmarks:doctor and fix what it reports, run both sessions above, then open an issue with each session’s summary.json and report.md from benchmarks/results/raw/<session>/. Do not edit this page: it is generated.