I have the following configuration in my Spring Boot application:
@Configuration @EnableAsync @Slf4j public class AsyncConfig { private static final int BUFFER = 1024; @Bean public AsyncTaskExecutor singleThreadAsyncTaskExecutor(Environment env) { RingBufferAsyncTaskExecutor rbAsyncExecutor = new RingBufferAsyncTaskExecutor(env); rbAsyncExecutor.setName("rb-executor"); rbAsyncExecutor.setBacklog(BUFFER); rbAsyncExecutor.setProducerType(ProducerType.SINGLE); rbAsyncExecutor.setWaitStrategy(new YieldingWaitStrategy()); log.info("Async task executor loaded"); return rbAsyncExecutor; } }
when I run it, CPU usage reaches 100% (sometimes 100 pieces):

research using visualvm i see this

but when I delete the AsyncTaskExecutor instance, the CPU load goes up by 0.4% and visualvm shows me just 1% of the CPU usage.
I found this problem when deploying it with docker, I saw how my use of the host hit the ceiling.
I tried to reduce the buffer size (it was 2048) to 1024, but nothing changed.
Without this bean, my @Async services @Async not work asynchronously. ( No TaskExecutor bean found for async processing )
source share