ZooKeeper 避坑实践:如何调优 jute.maxbuffer

本文深入探讨了ZooKeeper中jute.maxbuffer参数对服务稳定性的影响,分析了由于该参数设置不当导致的长时间无法选主、服务启动退出等问题。通过源码解析,揭示了jute.maxbuffer不仅限于Znode大小,还影响所有使用readString和readBuffer的Record。建议在客户端和服务端保持jute.maxbuffer设置一致,避免异常,并监控last_proposal_size指标以预防过大提案。同时,给出了在MSE ZooKeeper中调整参数和设置告警的实践建议。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

背景

在日常运维 ZooKeeper 中,经常会遇到长时间无法选主,恢复时进程启动又退出,进而导致内存暴涨,CPU 飙升,GC 频繁,影响业务可用性,这些问题有可能和 jute.maxbuffer 的设置有关。本篇文章就深入 ZooKeeper 源码,一起探究一下 ZooKeeper 的 jute.maxbuffer 参数的最佳实践。

1.png

2.png

分析

首先我们通过 ZooKeeper 的官网上看到 jute.maxbuffer 的描述:

jute.maxbuffer :
(Java system property: jute.maxbuffer).
......, It specifies the maximum size of the data that can be stored in a znode. The unit is: byte. The default is 0xfffff(1048575) bytes, or just under 1M.

When jute.maxbuffer in the client side is greater than the server side, the client wants to write the data exceeds jute.maxbuffer in the server side, the server side will get java.io.IOException: Len error

When jute.maxbuffer in the client side is less than the server side, the client wants to read the data exceeds jute.maxbuffer in the client side, the client side will get java.io.IOException: Unreasonable length or Packet len is out of range!

从官网的描述中我们可以知道,jute.maxbuffer 能够限制 Znode 大小,需要在 Server 端和 Client 端合理设置,否则有可能引起异常。

但事实并非如此,我们在 ZooKeeper 的代码中寻找 jute.maxbuffer 的

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值