In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the lack of SpringCloudHystrix thread pool how to do, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
Phenomenon:
Suddenly, many online APIs failed to get yesterday, and a large number of exceptions were found through kibana, with specific exception information:
... into fallback. Rejected command because thread-pool queueSize is at rejection threshold.
Source of exception code:
@ FeignClient (name = "api", fallbackFactory = LoadBalancingFallbackFactory.class) public interface LoadBalancingFeignClient {@ PostMapping (value = "/ api/loadBalancing/server") Result currentServer ();} @ Slf4j@Componentpublic class LoadBalancingFallbackFactory implements FallbackFactory {@ Override public LoadBalancingFeignClient create (Throwable throwable) {final String msg = throwable.getMessage (); return ()-> {log.error ("loadBalancingFeignClient currentServer into fallback. {}", msg); return Result.error ();}; * *
Reason:
It is obvious that this is due to the insufficient hystrix thread pool and the direct circuit breaker. Project apollo configuration:
Hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds = 3500hystrix.threadpool.default.maxQueueSize = 60hystrix.threadpool.default.queueSizeRejectionThreshold = 40
Brief Analysis of hystrix parameters:
MaxQueueSize: thread pool size, default is-1, the queue created is SynchronousQueue, if the setting is greater than 0, LinkedBlockingQueue is created based on its size.
QueueSizeRejectionThreshold: dynamically controls the upper limit of the thread pool queue. Even if the maxQueueSize does not reach the value of queueSizeRejectionThreshold, the request will be rejected. The default is 5.
Related source code:
HystrixAfter 1.5.12 proces sources.jarAccorptionAccording to the netflixripple hystrixActionGyCandle concurrencyUniverse HystrixContextScheduler.java
Private class HystrixContextSchedulerWorker extends Worker {private final Worker worker; private HystrixContextSchedulerWorker (Worker actualWorker) {this.worker = actualWorker;} @ Override public void unsubscribe () {worker.unsubscribe ();} @ Override public boolean isUnsubscribed () {return worker.isUnsubscribed ();} @ Override public Subscription schedule (Action0 action, long delayTime, TimeUnit unit) {if (threadPool! = null) {if (! threadPool.isQueueSpaceAvailable ()) {throw new RejectedExecutionException ("Rejected command because thread-pool queueSize is at rejection threshold.") } return worker.schedule (new HystrixContexSchedulerAction (concurrencyStrategy, action), delayTime, unit);} @ Override public Subscription schedule (Action0 action) {if (threadPool! = null) {if (! threadPool.isQueueSpaceAvailable ()) {throw new RejectedExecutionException ("Rejected command because thread-pool queueSize is at rejection threshold.");} return worker.schedule (new HystrixContexSchedulerAction (concurrencyStrategy, action));}}
Solution:
Properly enlarge Hystrix thread queue parameters dynamic horizontal expansion service optimizes downstream service and reduces service response time
Thank you for reading this article carefully. I hope the article "what to do if the SpringCloudHystrix thread pool is insufficient" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.