Zookeeper must write transactions to disk, otherwise, if you restart zookeeper, he will forget about any transactions that he heard. The way to write zookeeper to disk is that before zookeeper responds to the transaction, it will add the transaction to the transaction log file. When the transaction log file reaches a certain size, a new transaction log file is created.
Writing to transaction log files is inefficient on its own, since when you start zookeeper you will have to replay every transaction that it has ever processed. So periodically, zookeeper will write a snapshot of its current state in the memory database to a file. Then, at startup, zookeeper only downloads the snapshot, and all transaction logs since the snapshot was taken.
source share