On Thu, Aug 11, 2011 at 2:27 PM, David Precious <davidp@preshweb.co.uk> wrote:
On Thursday 11 August 2011 18:17:47 David Precious wrote:
Another possible alternative would be to fork a new process that will do the stuff in the background, whilst the original process continues
Being from a CGI background my initial thought was "yuck" because there I was thinking of how there would be all of the child processes spawned off without any kind of control. But as I thought about it a little more I realised that Dancer is usually used in an application situation (is it application, daemon, or some other term?) and so Dancer itself would keep running, unlike a CGI script, and so be able to manage the child processes. You could queue extra data if there are too many child processes or if the load is too high, etc. You shouldn't even need to serialize it as the OP mentioned unless it is large and you don't want it in memory or for data safety in case of a restart of the application. Is Dancer thread safe? as then you could use threads instead of forks. Regards, Colin.