上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 27 下一页
  2020年2月23日
摘要: netty 默认使用池化,堆外内存 // 创建内存分配器,使用池化,堆外。正常使用 netty 时,不需要自行创建 PooledByteBufAllocator allocator = new PooledByteBufAllocator(true); // 分配内存 ByteBuf buffer 阅读全文
posted @ 2020-02-23 16:49 偶尔发呆 阅读(747) 评论(0) 推荐(0)
  2020年2月21日
摘要: 最大堆外内存的配置 -XX:MaxDirectMemorySize=15g 分配堆外内存 java.nio.ByteBuffer#allocateDirect DirectByteBuffer 类是包权限的,使用 unsafe 分配和回收内存 class DirectByteBuffer exten 阅读全文
posted @ 2020-02-21 17:26 偶尔发呆 阅读(1283) 评论(0) 推荐(0)
  2020年2月19日
摘要: @Test public void testSelectMappedBuffer() throws IOException { // 1. 使用 mmap 映射磁盘上的文件 MappedFile mappedFile = new MappedFile("target/unit_test_store/ 阅读全文
posted @ 2020-02-19 16:30 偶尔发呆 阅读(265) 评论(0) 推荐(0)
  2020年2月18日
摘要: pipeline 添加 handler 的时候,如果没有指定线程池,则使用 channel 的 IO 线程池,即 NioEventLoop。 所以,NioEventLoop 的作用是,轮询 SocketChannel 的网络读事件,同时可以处理 handler 中的代码,以及 ChannelOutb 阅读全文
posted @ 2020-02-18 17:13 偶尔发呆 阅读(2089) 评论(0) 推荐(0)
摘要: 使用 netty,在业务层我们通常是调用 channel.write 或 channel.writeAndFlush,但是代码一路跟下来,没有发现加锁动作。 原因是,netty 在创建 channel 的时候,为每个 channel 分配一个 IO 线程,为每个 handler 分配一个业务线程,所 阅读全文
posted @ 2020-02-18 15:34 偶尔发呆 阅读(611) 评论(0) 推荐(0)
  2020年2月6日
摘要: 以 nacos StatefulSet 的部署为例 pod 的名字分别是 nacos-0,nacos-1,nacos-2 进入容器查看 /etc/hosts 文件 kubectl exec -it nacos-0 --container k8snacos -- /bin/bash cat /etc/ 阅读全文
posted @ 2020-02-06 12:42 偶尔发呆 阅读(845) 评论(0) 推荐(0)
  2020年2月2日
摘要: java 中的对象,请求和响应都是一个 RemotingCommand 对象。 RemotingCommand code 请求码,请求码/响应码 CommandCustomHeader 对应的请求头 byte[] 请求体,非必需 如下是一个 RegisterBrokerRequestHeader 对 阅读全文
posted @ 2020-02-02 13:54 偶尔发呆 阅读(733) 评论(0) 推荐(0)
  2020年2月1日
摘要: demo public class ByteBufferTest { /** * 1. ByteBuffer 分为 2 种,HeapByteBuffer 和 DirectByteBuffer,即堆内和堆外 * 2. ByteBuffer 的使用,就是 put 和 get,同时伴随着移动 postit 阅读全文
posted @ 2020-02-01 16:28 偶尔发呆 阅读(255) 评论(0) 推荐(0)
摘要: java 引用分为强,软,弱,虚 强引用,即平常创建对象得到的引用,如果一个对象存在强引用,它是不会被 GC 回收的。 但是如果一个对象只有软引用或弱引用,则当发生 GC 时 软引用:如果内存不足,则回收 弱引用:不管内存是否充足,回收 这里主要总结下弱引用的使用方法:弱引用对象被回收时,对象被回收 阅读全文
posted @ 2020-02-01 13:36 偶尔发呆 阅读(386) 评论(0) 推荐(0)
  2020年1月31日
摘要: DefaultMQPushConsumerImpl 拉取消息,放入 processQueue 的 TreeMap 中 // org.apache.rocketmq.client.impl.consumer.DefaultMQPushConsumerImpl#pullMessage boolean d 阅读全文
posted @ 2020-01-31 13:50 偶尔发呆 阅读(2270) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 27 下一页