<@U078Y59KC3B> How does the Go Pulsar client utili...
# ask-ai
s
@RunLLM How does the Go Pulsar client utilise the
MemoryLimitBytes
client option? What happens if the memory limit is about to be breached?
r
The Go Pulsar client uses the
MemoryLimitBytes
option to set a cap on the total memory usage for all producers and consumers under a client instance. When this limit is approached, producers and consumers compete for the assigned memory. If memory usage exceeds 75%, the consumer's receiver queue expansion is blocked; if it exceeds 95%, the consumer's receiver queue is shrunk. Actual memory is only freed as pending messages are consumed, so inactive consumers may still hold memory until they process messages. The memory limit is not enforced by default and must be explicitly set in the client options. For implementation details, see PIP 74: Pulsar client memory limits and client-libraries-clients documentation. Would you like more detail on the internal shrinking logic or how to configure this in code? Sources: - client-libraries-clients documentation - Support consumer client memory limit (Go) - Support consumer client memory limit (Java) 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
s
@RunLLM is it recommended to set the
MemoryLimitBytes
client option?
r
It is not required to set
MemoryLimitBytes
by default; the Go Pulsar client leaves it unset unless you explicitly configure it. Setting a memory limit can help prevent client-side out-of-memory (OOM) issues, especially in high-throughput or resource-constrained environments, but it may introduce competition between producers and consumers for memory, potentially impacting throughput or causing blocking if the limit is too low. According to PIP 74 and official docs, enable it if you need to control memory usage tightly; otherwise, the default (unlimited) is suitable for most use cases. Would you like more detail on best practices for setting this value? Sources: - official docs 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.