views:

81

answers:

1

I have an apache2 / mod_perl website. On one page, I need to do some server/server communication via SOAP.

The results of this communication are not required for the rendering of the page (but user input is required to trigger this communication).

The SOAP communication is very slow.

So what I want to do is process and print the page for the user, then do all the SOAP stuff behind the scenes.

What's the best way to achieve this? start some fork? write the job to a file and have a cronjob pick it up?

Thanks

+7  A: 

There are two types of solutions: First you can do what Randal Schwartz suggested here. Second you could use a Message Queue like Beanstalk or Gearman. Beanstalk has a Perl Client and is now persistent and is ideal for lightweight stuff. Gearman on the other hand has more features, more worked on. There is also TheSchwartz - use it if you can do without too much documentation. cron is ideal for systematically repeating tasks. For the kind of application you have, it appears that Schedule::At might be more appropriate if you prefer a more generic "message-queue"

Also see an old StackOverflow Thread here

Gurunandan