How can I defer processing during apache / mod_perl page rendering?
Asked Answered
E

1

5

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

Evanescent answered 18/12, 2009 at 16:14 Comment(0)
G
7

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

Grassofparnassus answered 18/12, 2009 at 16:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.