This property sets the maximum number of requests allowed to a HystrixCommand.run() method when you are using ExecutionIsolationStrategy.SEMAPHORE. If this maximum concurrent limit is hit then subsequent requests will be rejected. The logic that you use when you size a semaphore is basically the same as when you choose how many threads to add to a thread-pool, but the overhead for a semaphore is far smaller and typically the executions are far faster (sub-millisecond), otherwise you would be using threads. For example, 5000rps on a single instance for in-memory lookups with metrics being gathered has been seen to work with a semaphore of only 2. The isolation principle is still the same so the semaphore should still be a small percentage of the overall container (i.e. Tomcat) thread pool, not all of or most of it, otherwise it provides no protection.
时间: 2024-04-28 13:19:57 浏览: 7
这段话是关于HystrixCommand执行隔离策略为SEMAPHORE时设置的maxConcurrentRequests属性的说明。当达到此最大并发限制时,后续请求将被拒绝。调整信号量大小的逻辑与选择添加到线程池中的线程数的逻辑基本相同,但信号量的开销要小得多,通常执行速度也更快(亚毫秒级别),否则您将使用线程。例如,在内存查找时收集指标的单个实例上,5000rps已被看作使用仅为2的信号量可以工作。隔离原则仍然相同,因此信号量应该是整个容器(例如Tomcat)线程池的一小部分,而不是全部或大部分,否则它将不提供保护。
相关问题
An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way.
I'm sorry, but I don't quite understand your question. It seems like you're describing an error message related to HTTP requests. If you can provide more information or context, I may be able to assist you better.
requests Note: you may need to restart the kernel to use updated packages.
requests是一个Python第三方库,用于发送HTTP请求。它可以发送HTTP/1.1请求,包括GET、POST、PUT、DELETE、HEAD和OPTIONS等方法,支持HTTP/HTTPS和URL编码。requests库的优点是简单易用,支持连接池、节流阀、自动重试等特性,还支持文件上传、Cookie保持会话等功能。同时,requests库还支持自定义请求头、代理、SSL验证等高级功能。如果你需要在Python中发送HTTP请求,requests是一个非常好的选择。