是否可以在处理请求时使用 PHP 对 Apache 网络服务器实施即发即弃的网络请求
Is it possible to implement a fire-and-forget web request to an Apache webserver with PHP while processing a request
我有一个webrequest处理实时调用(需要处理时间在100ms以内),某些操作耗时很长(250ms)。我正在检查是否可以在处理原始请求时触发并忘记 Web 请求?到目前为止,我已经收集到:
可以在 php 中创建异步 http post 使用:
Asynchronous PHP calls?
Apache 在请求连接完成后立即停止处理
关闭:
http://activelamp.com/blog/development/asynchronous-php-with-message-queues/
使用 php 线程与消息队列(类似于 #2)
如果可能的话,请告诉我方法并指出来源。
正如@ArtisticPhoenix 在评论中发表的那样,可以使用:
exec("curl $url > /dev/null 2>&1 &");
对于缩放问题,我没有进一步采用该解决方案。
我有一个webrequest处理实时调用(需要处理时间在100ms以内),某些操作耗时很长(250ms)。我正在检查是否可以在处理原始请求时触发并忘记 Web 请求?到目前为止,我已经收集到:
可以在 php 中创建异步 http post 使用: Asynchronous PHP calls?
Apache 在请求连接完成后立即停止处理 关闭: http://activelamp.com/blog/development/asynchronous-php-with-message-queues/
使用 php 线程与消息队列(类似于 #2)
如果可能的话,请告诉我方法并指出来源。
正如@ArtisticPhoenix 在评论中发表的那样,可以使用:
exec("curl $url > /dev/null 2>&1 &");
对于缩放问题,我没有进一步采用该解决方案。