executorservice - Spring Integration - If Poller and TaskExecutor are not in tune then memory leak -


in below 7.1.7 asynchronous polling section of spring integration doc, memory leak might occur if poller , taskexecutor not in tune explained. did not understand it.

http://docs.spring.io/autorepo/docs/spring-integration/3.0.x/reference/html/messaging-endpoints-chapter.html#async-polling

<int:service-activator input-channel="publishchannel" ref="myservice">     <int:poller receive-timeout="5000" task-executor="taskexecutor" fixed-rate="50"/> </int:service-activator>  <task:executor id="taskexecutor" pool-size="20" queue-capacity="20"/> 

the above configuration demonstrates 1 of out of tune configurations.

the poller keeps scheduling new tasks though threads blocked waiting either new message arrive, or timeout expire. given there 20 threads executing tasks 5 second timeout, executed @ rate of 4 per second (5000/20 = 250ms). but, new tasks being scheduled @ rate of 20 per second, internal queue in task executor grow @ rate of 16 per second (while process idle), have memory leak.

one of ways handle set queue-capacity attribute of > task executor 0.

can please elaborate it.

here understanding of above code:

pool-size 20 - 20 threads execute.

receive-timeout 5 seconds: 20 threads given 5 seconds complete tasks.

fixed rate 50 ms - new tasks being scheduled @ rate of 20 per second.

i have few questions:

q. happen if takes more 5 seconds execute 20 threads?

q. in doc, said tasks executed @ rate of 4 per second. but, tasks might run in less 4 seconds , take more time.

q. how causes memory leak? if there no threads , queue available, executor rejects per rejection policy instead.

q. how setting queue-capacity 0 helps here? per understanding, if threads busy executor put them in queue until reaches queue-capacity.

the documentation incorrect - memory leak if have unbounded queue , message processing can't keep up. opened jira issue correct it.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -