Git Product home page Git Product logo

Comments (10)

fengjiachun avatar fengjiachun commented on May 22, 2024 1

@Coneboy-k 不错, 是计划用hash时间轮试一试

from jupiter.

scanry avatar scanry commented on May 22, 2024

那么我们再回到问题的本质:就是删除异步调用future。也就是在客户端调用服务端客户端没有收到服务响应,那么超时后uture会一直占用cache。
如果在发起调用后将要监听的异步future票据插入时间轮队列的时间O(lgn)接收不了的话,那么还可以加一层普通FIFO队列,然后单独一个守护线程处理这个future票据将它插入时间轮队列,这样发起调用线程的时间花费那么就变成O(1)。
这样的话是不是也减少了发起调用前将future插入cache 同 扫描cache中过期future线程 的 锁竞争?

from jupiter.

Coneboy-k avatar Coneboy-k commented on May 22, 2024

使用 类似于netty 的Channel idle 的检测机制(HashedWheelTimer)如何?

from jupiter.

fengjiachun avatar fengjiachun commented on May 22, 2024

@scanry @Coneboy-k 对于队列容量是个考验, 因为future只有超时的情况才会被移除

from jupiter.

fengjiachun avatar fengjiachun commented on May 22, 2024

future在chm中的时候只要响应回复了就可以移除

from jupiter.

Coneboy-k avatar Coneboy-k commented on May 22, 2024

我的CHM 存future不变。
增加一个Futur超时管理的Service 。 Service的管理的超时对象,是继承于AbsTimerItem 。 其中 AbsTimerItem有超时读和写的方法,最终在Service中可以封装成接口暴露给存future的CHM。这样写法耦合度很低。不需要改变太多代码
其中对应关系为 Service:timerObj:future=M:1:1

PoolItemService.java
https://gist.github.com/Coneboy-k/9c7496abc45012f6943d2a94ffcfa93a
AbsTimerItem.java
https://gist.github.com/Coneboy-k/4c0cc857425e32f80a8a0bf1739d28be

如果思路没问题,我尝试提交个PR
上面的还是参考大佬 netty idle的检测实现的。 :-)

from jupiter.

fengjiachun avatar fengjiachun commented on May 22, 2024

@scanry 的提醒, 超时队列只存放invokeId, 然后再回到DefaultInvokeFuture#roundFutures中查找future就可以了

from jupiter.

fengjiachun avatar fengjiachun commented on May 22, 2024

忘了关联到这个issue上了

from jupiter.

fengjiachun avatar fengjiachun commented on May 22, 2024

@Coneboy-k 你给的链接打不开啊

from jupiter.

Coneboy-k avatar Coneboy-k commented on May 22, 2024

@fengjiachun gist.github.com 貌似被墙了。挂个代理试试?

from jupiter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.