Project: Apache RocketMQ (App Definition and Development / Streaming & Messaging)
File: README.md

RocketMQ tiered storage allows users to offload message data from the local disk to other cheaper and larger storage mediums. So that users can extend the message reserve time at a lower cost. And different topics can flexibly specify different TTL as needed. This article is a cookbook for RocketMQ tiered storage. Use the following steps to easily use tiered storage Change `messageStorePlugIn` to `org.apache.rocketmq.tieredstore.TieredMessageStore` in your `broker.conf`. Configure your backend service provider. change `tieredBackendServiceProvider` to your storage medium implement. We give a default implement: POSIX provider, and you need to change `tieredStoreFilePath` to the mount point of storage medium for tiered storage. Start the broker and enjoy! The following are some core configurations, for more details, see | Configuration | Default value | Unit | Function | | - || -- | - | | messageStorePlugIn | | | Set to org.apache.rocketmq.tieredstore.TieredMessageStore to use tiered storage | | tieredMetadataServiceProvider | org.apache.rocketmq.tieredstore.metadata.DefaultMetadataStore | | Select your metadata provider | | tieredBackendServiceProvider | org.apache.rocketmq.tieredstore.provider.PosixFileSegment | | Select your backend service provider | | tieredStoreFilePath | | | Select the directory using for tiered storage, only for POSIX provider. | | tieredStorageLevel | NOTINDISK | | The options are DISABLE, NOTINDISK, NOTINMEM, FORCE | | tieredStoreFileReservedTime | 72 | hour | Default topic TTL in tiered storage | | tieredStoreGroupCommitCount | 2500 | | The number of messages that trigger one batch transfer | | tieredStoreGroupCommitSize | 33554432 | byte | The size of messages that trigger one batch transfer, 32M by default | | tieredStoreMaxGroupCommitCount | 10000 | | The maximum number of messages waiting to be transfered per queue | | readAheadCacheExpireDuration | 1000 | millisecond | Read-ahead cache expiration time | | readAheadCacheSizeThresholdRate | 0.3 | | The maximum heap space occupied by the read-ahead cache | Tiered storage provides some useful metrics, see for details. | Type | Name | Unit | | | | | | Histogram | rocketmqtieredstoreapilatency | milliseconds | | Histogram | rocketmqtieredstoreproviderrpc_latency | milliseconds | | Histogram | rocketmqtieredstoreproviderupload_bytes | byte | | Histogram | rocketmqtieredstoreproviderdownload_bytes | byte | | Gauge | rocketmqtieredstoredispatchbehind | | | Gauge | rocketmqtieredstoredispatchlatency | byte | | Counter | rocketmqtieredstoremessagesdispatch_total | | | Counter | rocketmqtieredstoremessagesout_total | | | Counter | rocketmqtieredstoregetmessagefallbacktotal | | | Gauge | rocketmqtieredstorereadaheadcachecount | | | Gauge | rocketmqtieredstorereadaheadcachebytes | byte | | Counter | rocketmqtieredstorereadaheadcacheaccess_total | | | Counter | rocketmqtieredstorereadaheadcachehit_total | | | Gauge | rocketmqstoragemessagereservetime | milliseconds | We need community participation to add more backend service providers for tiered storage. , the implementation provided by default is just an example. People who want to contribute can follow it to implement their own providers, such as S3FileSegment, OSSFileSegment, and MinIOFileSegment. Here are some guidelines: Extend and implement the methods of interface. Record metrics where appropriate. See `rocketmqtieredstoreproviderrpclatency`, `rocketmqtieredstoreprovideruploadbytes`, and `rocketmqtieredstoreproviderdownload_bytes` No need to maintain your own cache and avoid polluting the page cache. It is already having the read-ahead cache.