i ran load test on application find maximum number of threads needed support planned load. have used executor service cachedthreadpool threads created dynamically based on load. know value of max thread count using "getlargestpoolsize()", should replace cachedthreadpool fixedthreadpool(maxvalue), avoid large (integer.max_value) thread creation behavior of cachedthreadpool, kindly suggest pros , cons, thank you.
the important difference between cached thread pool , fixed thread pool in java cached thread pool has no upper limit on number of threads spawn , use. 1 preferred depends on want scaling behavior like.
the main advantage of cached thread pool threads begin execution if have unanticipated large number of tasks execute. example, business needs may increase on months or years, , application may moved more powerful machines, , use of cached thread pool permit servicing increased needs using increased available processing power without having change code. can advantage since once application has been in service months or years, people may not remember code enough identify thread limit parameter can changed improve performance.
the main advantage of fixed thread pool number of threads more tightly controlled. helps prevent other parts of software installation - either within application or in other applications - being starved of processing power should application receive large number of tasks in short period of time. in addition, risk of running operating system threading limit reduced, reducing risks of software crashes can result when process needs spawn thread , not able so.
Comments
Post a Comment