file inbound-channel-adapter performance issue

白昼怎懂夜的黑 提交于 2019-12-11 20:22:00

问题


We have a spring integration application which will monitor on an incoming folder then process the files. When the application is down for maintenance or some other reason the incoming folder is filled with 100K files by upstream application. When restart application it is getting frozen it is not processing incoming files may be trying to load all the incoming files.

Here is configuration

<file:inbound-channel-adapter id="inFiles" channel="inFilesin" directory="file:${incoming.folder}" 
    queue-size="300" filename-regex="(?i)^(?!.*writing) " auto-startup="true" auto-create-directory="false" >
        <int:poller id="fw.fileInboudPoller" fixed-rate="1" receive-timeout="3" time-unit="SECONDS"
            max-messages-per-poll="10" task-executor="taskExecutor" />
</file:inbound-channel-adapter>

<task:executor id="taskExecutor" pool-size="10-20" queue-capacity="20" rejection-policy="CALLER_RUNS" />

Appreciate your help.

Thanks, Mohan


回答1:


Suggest change fixed-rate to fixed-delay.

Your files are processed very slow and the first option sais that the new task should be started just afer that time (in your case 1 sec.).

Another problem - rejection-policy="CALLER_RUNS". In this casem if your thead queue will be exhausted (and it is in you case of 100K files), the scheduled thread does the real work. Poller, to schedule tasks, uses ThreadPoolTaskScheduler with size 10. So, with this "havy-load" your app may be frozen, because that pool is shared for all application.

So, try to use fixed-delay. In this case your app won't be frozen, but files will be processed slower.

Maybe this can help you: <int:resource-inbound-channel-adapter> ?



来源:https://stackoverflow.com/questions/20054190/file-inbound-channel-adapter-performance-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!