Answer the question
In order to leave comments, you need to log in
How to use max cpu for multithreaded task?
There is a service that now works in parallel with ~ 2000 clients and, accordingly, flows to them.
Previously, this was done through:
@Configuration
@EnableAsync
public class AsyncConfig implements AsyncConfigurer {
@Bean(name = "threadPoolTaskExecutor")
public Executor threadPoolTaskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(Runtime.getRuntime().availableProcessors());
executor.initialize();
return executor;
}
Answer the question
In order to leave comments, you need to log in
A simple resource in itself is not a problem, but a blessing. The problem is the downtime of resources with a noticeable degradation of the service.
How long does it take for an answer? How long does it take to run 1 query at zero load? At what number of requests does the degradation of the service occur? увеличить использование процессора
And ускорить выполнение
they don't have to go together. The processor may be idle because it is waiting for I/O, but also because it can easily cope with the current load.
In any case, you should ask not at the toaster, but at the profiler: where does the CPU time go, in what situations does the idle CPU appear, what is the ratio of idle time to useful work. If the service waits a long time for input-output, it is necessary to speed up the input-output, and not try to load the processor.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question