multithreading - Grails performing time consuming tasks in controller vs another thread -
in grails have time consuming task reads 1000 csv files each containing 1 word per line. reads each file , moves word per line database.
what difference in memory consumed if perform task in controller (main thread) or in thread spawned in controller?
i have faced out of memory errors due jvm totally quit live website , had restart tomcat.
could due time consuming task in controller thread(hence more memory consumed)?
p.s. more interested in finding difference in memory consumed in controller thread , thread created in controller.
it depends on overall requirements, load (how this), architecture, available software , hardware.
first of all, task etl (extract transform load) systems. if can't afford 1 (or boss strictly against it) can use several other approaches offload controller.
dedicated server - install db load onto box. define communication channels. asynchronously notified when load finishes , pass info onto user.
in process processing. when spawn thread (or threads) heavy lifting.
gpars
come rescue here.you use grails built-in async features specified here
back original question. wouldn't think loading 100s of csv in controller. if implement this, i'd go etl it's suitable kind of tasks.
Comments
Post a Comment