java - How to deal with a search task which takes more time than usual in Spring 3.0 -


i looking ideas on how deal search related task takes more usual time (in human terms more 3 seconds)

i have query multiple sources, sift through information first time , cache in db later quick return.

the context of project j2ee, spring , hibernate (on top of springroo)

the possible solutions think of -on webpage let user know task running in background, if possible give them queue number or waiting time. refresh page via controller checks if task done, when done (ie search result prepared , stored in db) forward new controller , fetch result db

-the background tasks done spring task executor. not sure if easy give measure of how long take. bad idea let search terms run concurrently, sort of pooling idea.

-another option use background tasks use jms. perhaps solution more control (retries etc)

-spring batch comes mind

please suggest how it. appreciate semi-detailed+ description. sources of info can man , can sequential in nature can take upto 4-5 minutes results form. possible such tasks run automatically in background without user intervention (ie update sources)

from user perspective, use ajax. default web page contains kind of "busy" indicator. when ajax request completes, busy indicator replaced result.

in background, request handlers multi-threaded. can format default result, close&flush output, , processing in current thread. should put in session or db make sure no 1 can start same heavy process second time.

running task pools in web container possible there caveats, how synchronize startup/shutdown: want web server "hang" during shutdown while thread busy collecting results? additional load should considered. might better use jms , offload strain second server dedicated build search results.

such system scale better if searches start become burden. makes trivial automate process writing small program posts searches in jms queue.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -