如何在 apache / mod_perl 页面渲染期间推迟处理?
我有一个 apache2 / mod_perl 网站。在一页上,我需要通过 SOAP 进行一些服务器/服务器通信。
页面呈现不需要此通信的结果(但需要用户输入来触发此通信)。
SOAP 通信非常慢。
所以我想做的是为用户处理和打印页面,然后在幕后完成所有 SOAP 工作。
实现这一目标的最佳方法是什么?开始一些叉子吗?将作业写入文件并让 cronjob 接收它?
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有两种类型的解决方案:首先,您可以按照 Randal Schwartz 此处的建议进行操作。其次,您可以使用消息队列,例如 Beanstalk 或 Gearman. Beanstalk 有一个 Perl 客户端,现在是持久的,非常适合轻量级的东西。另一方面,Gearman 有更多功能,也有更多改进。还有 TheSchwartz - 如果不需要太多文档就可以使用它。
cron
非常适合系统地重复任务。对于您拥有的应用程序类型, Schedule::At 可能是如果您更喜欢更通用的“消息队列”,则更合适 另请参阅旧的 StackOverflow 线程 此处
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