-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disruptor发生内存溢出问题讨论 #94
Comments
嗯,其实我想表达的意思是:
阻塞的情况肯定是数据没有被消费导致生产者阻塞了,这是一个阻塞队列的基本功能。 |
@crossoverJie |
忘了说这个前提了,前提是有消费之后才会覆盖。 比如我文章里面模拟的 8 个坑的队列。 主线程写入 10 条数据,消费线程去消费,肯定边消费边生产的。 如下图所示:
这样的场景肯定会导致生产者阻塞。 我在这里模拟消费比较慢的场景。
通过日志会发现生产者很快把 8 个消息写进入,到第 9 个的时候就阻塞了等到消费一条数据之后才会继续生产数据。 dump 线程也会发现 main 线程作为生产者确实是 waiting 状态。 |
@crossoverJie |
你好:
阅读了作者您的博客:https://crossoverjie.top/2018/08/29/java-senior/OOM-Disruptor/ 之后,自己也动手写了下单元测试,oom问题无疑,但是对于博客中有一段话存在不解:“我设置队列大小为 8 ,从 0~9 往里面写 10 条数据,当写到 8 的时候就会把之前 0 的位置覆盖掉,后面的以此类推(类似于 HashMap 的取模定位)。”;而我的单侧中,event数大于buffersize的时候,produce.publish方法回阻塞,我的单测地址:
sosojustdo/disruptor-learning@fb74612
The text was updated successfully, but these errors were encountered: