摘要:
节点初始状态为 candidate // io.openmessaging.storage.dledger.MemberState#role private volatile Role role = CANDIDATE; 处理选举的逻辑在 DLedgerLeaderElector 类中 io.ope 阅读全文
摘要:
commitLog 删除文件的策略指定时间到了,磁盘不足,人工删除,满足任一条件,判断文件是否过期或者磁盘严重不足(超过 85%),是则删除,一批次最多删除 10 个文件。 有个地方需要注意,mmap 写文件,windows 观察,发现文件的修改时间戳一直不变,linux 还未验证。 commitL 阅读全文
摘要:
netty 是事件驱动的,这里面有两个含义,一是 netty 接收到 socket 数据后,会产生事件,事件在 pipeline 上传播,二是事件由特定的线程池处理。 NioEventLoop 轮询网络事件 // io.netty.channel.nio.NioEventLoop#processSe 阅读全文
摘要:
netty 默认使用池化,堆外内存 // 创建内存分配器,使用池化,堆外。正常使用 netty 时,不需要自行创建 PooledByteBufAllocator allocator = new PooledByteBufAllocator(true); // 分配内存 ByteBuf buffer 阅读全文
摘要:
最大堆外内存的配置 -XX:MaxDirectMemorySize=15g 分配堆外内存 java.nio.ByteBuffer#allocateDirect DirectByteBuffer 类是包权限的,使用 unsafe 分配和回收内存 class DirectByteBuffer exten 阅读全文
摘要:
@Test public void testSelectMappedBuffer() throws IOException { // 1. 使用 mmap 映射磁盘上的文件 MappedFile mappedFile = new MappedFile("target/unit_test_store/ 阅读全文
摘要:
pipeline 添加 handler 的时候,如果没有指定线程池,则使用 channel 的 IO 线程池,即 NioEventLoop。 所以,NioEventLoop 的作用是,轮询 SocketChannel 的网络读事件,同时可以处理 handler 中的代码,以及 ChannelOutb 阅读全文
摘要:
使用 netty,在业务层我们通常是调用 channel.write 或 channel.writeAndFlush,但是代码一路跟下来,没有发现加锁动作。 原因是,netty 在创建 channel 的时候,为每个 channel 分配一个 IO 线程,为每个 handler 分配一个业务线程,所 阅读全文
摘要:
以 nacos StatefulSet 的部署为例 pod 的名字分别是 nacos-0,nacos-1,nacos-2 进入容器查看 /etc/hosts 文件 kubectl exec -it nacos-0 --container k8snacos -- /bin/bash cat /etc/ 阅读全文
摘要:
java 中的对象,请求和响应都是一个 RemotingCommand 对象。 RemotingCommand code 请求码,请求码/响应码 CommandCustomHeader 对应的请求头 byte[] 请求体,非必需 如下是一个 RegisterBrokerRequestHeader 对 阅读全文