4. Summary
Before optimization, 10 million messages required 240MB of memory, with an average memory size per message (AES) of 240*1024*1024/10000000 byte = 25.16 bytes. After using the new algorithm, we can easily reduce AES to below 1 byte, and achieving 0.163 byte (i.e., 1.304 bits) is not difficult either, achieving huge optimization and already approaching the theoretical lower bound of 1 bit.
With this optimization, Pulsar can easily handle a scale of hundreds of billions of delayed messages. For example, conservatively estimating AES as 0.5 byte, then 100 billion messages with a batch size of 100 only consume memory of
0.5*100000000000/1024/1024/1024/100GB=0.46GB
Of course, it can also handle a trillion-level scale of delayed messages, with memory pressure distributed across different brokers in the cluster, and the pressure is not high.
It is hoped that after reading this article, you can make full use of the performance of the TimeBucket algorithm according to actual application scenarios, reduce memory resource usage, and help business succeed.
Last updated
Was this helpful?

