ExecutorService threads are not starting/shutting down in timely fashion before threads are started or ended (random).
Workflow
Java RestAPI, executes same request in concurrently each request spins 36 subthreads using ExecutorServer FW.
3 Rest calls * 36 executor threads each = 108 total threads concurrent in JVM.
Machine : Linux, 16 CPU, 12GIG JVM box
Observation : delay is seen after Executors invokeAll and before call method invocation.
Debug : I have put logger before invokeAll method and on the first line of call method entry. Loggers shows delay of 1.5 seconds to 2seconds
Code :
We always see delay in these loggers in weblogic out logs (same is shared with thread details in earlier updates on this SR)
invokeAll Loggers :
List<Future<CmRateServiceProcessorData>> rateServiceProcessorOutputList = null;
ExecutorService executorService =Executors.newFixedThreadPool(threadPoolSize,factory);
logger.error(requestId+ " Invoking Threads In " +(System.currentTimeMillis()) + "ms");
rateServiceProcessorOutputList = executorService.invokeAll(rateServiceProcessorList);
Call Method Loggers :
@Override
public CmRateServiceProcessorData call() throws Exception {
FrameworkSession session = null;
logger.error(" Started CmRateServiceProcessorData "+ Thread.currentThread().getName());
Attached logs show :
TS : 2023-02-09 21:06:01,968 Just before invokeAll was hit.
Actual threads (call) started at TS : 2023-02-09 21:06:04,338 (after 2.2seconds), these threads were further completed less than 80ms
All Threads were shutdown after 2.5seconds on TS : 2023-02-09 21:06:04,538
Overall, This delay is observed either before starting (time between invokeAll and call method) or after completing call method and termination of threads....
actual logic in call method always runs in 80 to 300ms.
SR : I have raised SR with Java but there are unable to address, instead they have forwarded the SR to WebLogic team. I feel this is core java and not a WebLogic even if my app is running on WebLogic, ExecutorService will run in JVM and not on WebLogic.