定时任务的时间限制是多少?

What is the time limit for a scheduled task?

我正在处理最终将成为计划任务的任务,而且可能会相当长 运行ning。我通过在查询控制台中调用 xdmp.spawn() 来测试它,并且不得不增加默认的 timeLimit 参数。据我了解,xdmp.spawn() 将使用为应用服务器设置的默认时间限制,您可以指定不同的 timeLimit 直到应用服务器的最大时间限制参数。

但是定时任务的时间限制是多少?我什至不清楚他们运行在什么应用服务器上。似乎没有办法指定不同的时间限制,所以它会使用默认或最大时间限制吗?

普遍接受的最佳做法是 运行 服务器外部的长任务,并向服务器发出请求以迭代任务的工作(如果工作可以在某些方面进行分区,则可能是并发请求方式)。

任务服务器旨在对服务器内的事件做出反应,而不是 运行宁长进程。

如果任务依赖于服务器状态,外部进程可以轮询服务器以查看是否需要完成工作。

或者,在任务服务器上执行的任务可以使用 xdmp.http*() 内置函数通知外部进程它需要 运行.

希望有用,

如果没有为任务主机.

指定主机,计划任务将在分配的主机或所有主机上执行

https://docs.marklogic.com/guide/admin/scheduling_tasks#chapter

  1. In the Task User and Task Host fields, specify the user with permission to invoke the task and the host computer on which the task is to be invoked. If no host is specified, then the task runs on all hosts.

默认任务服务器时间限制类似于任何其他应用程序服务器:

  • 默认时间限制600
  • 最大时间限制3600

您可以在管理员 UI 中验证(并调整)此设置,方法是: Configure -> Groups -> Default (or whichever group your server is in) -> Task Server

https://docs.marklogic.com/admin-help/task-server

  • max time limit specifies the upper bound for any request's time limit. No request may set its time limit (for example with xdmp:set-request-time-limit) higher than this number. The time limit, in turn, is the maximum number of seconds allowed for servicing a query request. The App Server gives up on queries which take longer, and returns an error.
  • default time limit specifies the default value for any request's time limit, when otherwise unspecified. A request can change its time limit using xdmp:set-request-time-limit. The time limit is the default number of seconds allowed for servicing a query request.