doudu7626
doudu7626
2014-01-17 10:22

客户端断开连接后,mongodb应该终止map-reduce进程

已采纳

I connect to mongodb with php's driver and make a map-reduce command. Sometimes the mapreduce takes a long time and this is not a problem for me, at least for now.

The problem is that when I kill the php process, the map-reduce continues to work. I want that when a client disconnects, its all processes should stop too. Because the results of the processes are no longer necessary.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • duanhuo3392 duanhuo3392 7年前

    The problem is that when I kill the php process, the map-reduce continues to work.

    How can MongoDB know the PHP process was killed, all it sees is a command on a connection came in and that connection is still being used.

    This is one reason why you SHOULDN'T run Map Reduce inline to your application and why it is recommended not to.

    This same problem applies to web servers when in connection to browsers, a PHP process will conitnue running when a browser is closed.

    点赞 评论 复制链接分享