1. springboot built tomcat container configuration parameters
server: Port: 12021 # Server socket end over time (in milliseconds), the value - 1 represents no (i.e., unlimited) expires, the default value is 60000 (i.e., 60 seconds) # Tomcat server.xml that comes with the standard set this value to 20000 (ie 20 seconds), unless disableUploadTimeout set to false, otherwise the body will use the read request timed out (if any) connection-timeout: 80000 tomcat: # URL Uniform Code uri-encoding: UTF-8 The maximum number of concurrent requests # processing, default values 200 max-threads: 1000 # Maximum number of connections in accepting and processing a given time, the default value 10000 max-connections: 20000 The minimum number of threads created when the # initialization, keep running, the default value of 10 min-spare-threads: 20 # The maximum number of queues listening port, after full client request is rejected (not less than maxSpareThreads), the default is 100 acceptCount: 700 # Cancel post size limit parameter, the default is 2097152 (2M) max -http-POST-size: -1 # HTTP request and response headers of the maximum size, in bytes specified, if not specified, this property is set to 8192 ( . 8 KB) max-http-header-size: 8192(8 KB)
Problems encountered in the development, the need to query tomcat official document: http://tomcat.apache.org/tomcat-8.0-doc/config/http.html#HTTP/1.1_and_HTTP/1.0_Support
2. spring cloud hystrix parameter configuration
hystrix.command.default and hystrix.threadpool.default in default to default CommandKey (default: current execution method name) Execution attribute to configuration: Isolation strategy, and SEMAPHORE have THREAD The THREAD - it is performed on a separate thread, the number of concurrent requests by threads in the thread pool limits SEMAPHORE - it is executed on the calling thread, concurrent requests is limited by counting semaphore . hystrix.command default .execution.isolation.strategy isolation strategy, the default is Thread, optional Thread | Semaphore In THREAD mode, the timeout period can be interrupted After in SEMAPHORE mode, waiting for execution is completed, go to determine whether the time-out Provided criteria: the retry, 99meantime + AVG Meantime; not the retry, 99 .5meantime hystrix.command. default .execution.isolation.thread.timeoutInMilliseconds command execution timeout, default 1000ms hystrix.command. default .execution.timeout.enabled whether to enable the implementation of a timeout, enabled by default true hystrix.command. default .execution.isolation.thread.interruptOnTimeout timeout occurs is whether to interrupt, default true (THREAD mode is active) execution.isolation.thread.interruptOnCancel When canceling occurs, whether the execution should be interrupted, the default value is false (THREAD mode is active) hystrix.command. default .execution.isolation.semaphore.maxConcurrentRequests maximum number of concurrent requests, the default 10, when the parameter when ExecutionIsolationStrategy.SEMAPHORE policy is in effect. If the maximum number of concurrent requests, the request will be rejected. Theoretically selection principle semaphore size and select the same thread size, but the selection of semaphore each execution unit to be relatively small and fast execution speed (ms level), otherwise it should thread semaphore should account for a small portion of the entire container (tomcat) thread pool Fallback related properties :( applied Hystrix the THREAD and SEMAPHORE policy) hystrix.command. default .fallback.isolation.semaphore.maxConcurrentRequests If the number of concurrent reaches the set value, the request will be rejected and thrown and the fallback is not called, the default 10 hystrix.command. default .fallback.enabled failed or when the request is denied, will try to call hystrixCommand.getFallback (), default true Collapser Properties parameters: hystrix.collapser. default .maxRequestsInBatch a single batch of the maximum number of requests, to trigger the batch number, the default Integer.MAX_VALUE hystrix.collapser. default delay .timerDelayInMilliseconds trigger batch, you can also create a batch of time + this value, the default 10 hystrix.collapser. default .requestCache.enabled whether cache of HystrixCollapser.execute () and HystrixCollapser.queue (), the default true ThreadPool parameters: The default value is the number of threads 10 for most cases (sometimes set smaller), if you need to set larger, it must have a basic formula can follow: requests per second at peak when healthy × 99th percentile latency in seconds + some breathing room The maximum number of requests per second support ( 99% of the average response time + buffer value) For example: to handle 1000 requests per second, 99% of the request response time is 60ms, then the formula is: 1000 * (0.060 + 0.012 ) Basic principles have to keep the thread pool as small as possible, mainly in order to release pressure and prevent resources being blocked. When everything is normal, the thread pool usually have only 1-2 threads activated to provide services. hystrix.threadpool. default maximum number of threads .coreSize concurrent execution, default 10 hystrix.threadpool. default .maxQueueSize BlockingQueue the maximum number of queues, and when set to -1, SynchronousQueue use, is positive when used LinkedBlcokingQueue. This setting is only effective during initialization, it can not be changed after the queue size threadpool unless reinitialising thread executor. Default -1 . hystrix.threadpool. default .queueSizeRejectionThreshold maxQueueSize not reached even after queueSizeRejectionThreshold reaches this value, the request will be denied. Because maxQueueSize can not be dynamically modified, this parameter will allow us to dynamically set the value. IF maxQueueSize == -1 , this field will have no effect hystrix.threadpool. default .keepAliveTimeMinutes and if corePoolSize maxPoolSize set to the same (default implementation) this setting is disabled. : If you via plugin (HTTPS // use custom implementations, this setting is only useful, github.com/Netflix/Hystrix/wiki/Plugins default 1.) hystrix.threadpool. Default time .metrics.rollingStats.timeInMilliseconds thread pool of statistical indicators The default 10000 hystrix.threadpool. default .metrics.rollingStats.numBuckets the rolling window is divided into n buckets, default 10
Actual use, in accordance with the error details, adjust parameters