The invention discloses a
thread pool dynamic scheduling method and
system, and the method comprises the steps: dividing the time of a time period into a plurality of time blocks, merging the time blocks with the average time consumption exceeding a set first threshold value, and taking the merged time blocks as an estimated
slow time period of a task A in a next time period; in response to an execution starting instruction of the task A, judging whether the
current time is in an estimated
slow time period of the task, if so, calculating comprehensive average time consumption based on average time consumption of the estimated
slow time period and total time consumption of the task in the estimated slow time period, comparing the comprehensive average time consumption with a set second threshold value, and determining a
thread pool allocated to the task; and if not, calculating the latest
execution time consumption based on the average value of the latest set m times of
execution time consumption of the task, comparing the latest
execution time consumption with a set second threshold value, and determining the
thread pool allocated to the task. According to the method, the thread
pool distributed to the task A can be adjusted in advance, the
system throughput can be improved, and the service stability is improved.