java - Hystrix 线程池 maximumSize、coreSize 和 allowMaximumSizeToDivergeFromCoreSize 不起作用?
问题描述
我已将 hystrix 线程池配置设置为 - coreSize=10
,maximumSize=100
并allowMaximumSizeToDivergeFromCoreSize=true
设置为 command 键。我部署了应用程序,但是当 QPS 很高时它拒绝线程 -
Caused by: java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@7bb2e868 rejected from java.util.concurrent.ThreadPoolExecutor@39627710[Running, pool size = 10, active threads = 10, queued tasks = 0, completed tasks = 3409]
at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2047)
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:823)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1369)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at com.netflix.hystrix.strategy.concurrency.HystrixContextScheduler$ThreadPoolWorker.schedule(HystrixContextScheduler.java:172)
at com.netflix.hystrix.strategy.concurrency.HystrixContextScheduler$HystrixContextSchedulerWorker.schedule(HystrixContextScheduler.java:106)
我正在使用hystrix-javanica 1.5.12
版本。这不起作用,因为排队的任务为 0。
其余的默认值如下(下面的名称被抽象了一点) -
isCircuitBreakerEnabled = true;
circuitBreakerRequestVolumeThreshold = 10;
isFallBackEnabled = false;
circuitBreakerSleepWindow = 10000;
circuitBreakerErrorThresholdPercentage = 50;
circuitBreakerForceOpen = false;
circuitBreakerForceClosed = false;
metricsRollingStats = 10000;
executionIsolationThreadTimeOut = 20000;
executionIsolationStrategy = "THREAD";
executionTimeOutEnable = true;
poolCoreSize = 10;
poolMaxSize = 15;
poolMaxQueueSize = -1;
keepAliveTime = 1;
poolQueueSizeRejectionThreshold = 1;
allowMaximumSizeToDivergeFromCoreSize = false;
我正在关注这个问题 - https://github.com/Netflix/Hystrix/issues/1436。2017 年又有人报告了此版本的类似问题。
您认为我缺少任何配置吗?我应该更改 executionIsolationStrategy 以Semaphore
使其工作吗?
解决方案
推荐阅读
- python - ImportError:密码学版本与加载的共享对象不匹配
- xml - 如何获取给定元素的最后一个非空子元素的位置
- r - 从 harvard dataverse 下载 csv 文件
- html - 如何使html页面根据时间更改背景颜色
- javascript - 如何解决 Javascript 中的警报引用错误?
- java - 如何为托管在 Kubernetes 中的多个应用程序选择 Kafka 事务 ID?
- react-native - 注册/登录后反应本机路由器通量路由
- c++ - 运算符重载取决于模板类型和虚拟运算符
- c# - 具有多态性的自定义 JSON 反序列化
- html5-canvas - 选择框被拖动,但不是对象