Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ExecutorService Threads; Delay between invokeAll and call method.

Rohit Jadhav-OracleFeb 27 2023 — edited Feb 27 2023

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.

Comments
Post Details
Added on Feb 27 2023
1 comment
645 views