Open
Description
The current req
and pub
driver have infinite capacity. This means that if for some reason messages accumulate in the pending requests queue, the application will eventually run out of memory and crash.
- example in req driver:
msg-rs/msg-socket/src/req/driver.rs
Lines 120 to 133 in 10070e6
We should add some sort of HWM that either blocks or drops messages after a specific capacity is reached.
An option could be to use LruCache instead of the current FxHashMap.
Further improvements include different StorageBackend
s including layered cache between memory and disk (e.g. LruCache -> RocksDB)
Edit:
- See conversation in Pubsub v1ย #9 (comment)
- On the subscriber level, a durability
Policy
settings should be added to indicate if we intend to receive cached messages or just the ones send from the connection point onward.