for a fairly performance compare between pulsar and kafka,we need to modify kafka configuration to align with pulsar,consider kafka did‘nt have an WAL mechanism to make the data safety, the data will first save in memory then respond to the client,and the data in memory will async flush to the persistent disk,so the data have the chance to lost , but pulsar use journal disk as WAL mechanism,so it can make sure every message written to pulsar will not lost。
we want every message written to kafka will be persistent to disk to make sure data safety
log.flush.interval.messages=1 # means every single message need to flush to disk,so it will impact the performance,need to tradeoff
we want when produce message to kafka,at least write to two brokers(same as pulsar‘s 2 write quorum)
min.insync.replicas=2 # make sure that when write data, there is 2 broker have recieved the data.
Attention: this configuration need to combine with producer configure ack=all
If we want to achieve the same safety level as pulsar provided in kafka, we can modify the above configuration in kafka broker and producer, but it will impact the performance of kafka.