Comments (10)
@Coneboy-k 不错, 是计划用hash时间轮试一试
from jupiter.
那么我们再回到问题的本质:就是删除异步调用future。也就是在客户端调用服务端客户端没有收到服务响应,那么超时后uture会一直占用cache。
如果在发起调用后将要监听的异步future票据插入时间轮队列的时间O(lgn)接收不了的话,那么还可以加一层普通FIFO队列,然后单独一个守护线程处理这个future票据将它插入时间轮队列,这样发起调用线程的时间花费那么就变成O(1)。
这样的话是不是也减少了发起调用前将future插入cache 同 扫描cache中过期future线程 的 锁竞争?
from jupiter.
使用 类似于netty 的Channel idle 的检测机制(HashedWheelTimer)如何?
from jupiter.
@scanry @Coneboy-k 对于队列容量是个考验, 因为future只有超时的情况才会被移除
from jupiter.
future在chm中的时候只要响应回复了就可以移除
from jupiter.
我的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.
经 @scanry 的提醒, 超时队列只存放invokeId, 然后再回到DefaultInvokeFuture#roundFutures中查找future就可以了
from jupiter.
from jupiter.
@Coneboy-k 你给的链接打不开啊
from jupiter.
@fengjiachun gist.github.com 貌似被墙了。挂个代理试试?
from jupiter.
Related Issues (20)
- service.Init()和model.Init()初始化位置问题
- DefaultRegistryServer#handlePublish(...)并发问题 HOT 2
- 关于DefaultClient中JConnector.ConnectionWatcher实现上的一些疑惑 HOT 1
- 这里提出两个个人认为可以改进的点, 大佬有空的话可以帮忙点评下
- Responsible disclosure policy
- RCE vulnerability
- Another approach capable of achieving RCE attacks
- Kryo Deserialization Vulnerability in Jupiter v1.3.1
- 对Reflects.fastInvoke benchmark结果的疑惑 HOT 6
- 不兼容java11 HOT 3
- Jupiter v1.3
- java.lang.NoClassDefFoundError: org/apache/curator/framework/api/BackgroundCallback异常 HOT 1
- [feature request]增加更优雅的异步调用方式 HOT 4
- 支持 Pipeline invoke
- 支持 batch decoder
- Benchmark client 代码增加流式发送能力
- 移除对 InvokeType.SYNC,InvokeType.AUTO 足够 ?
- jupiter 内置的日志框架打印的日志来源行数错误 HOT 3
- 服务端不可用的时候的并发问题 HOT 10
- Jupiter source/architecture analysis articles HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jupiter.