我有一个xquery文件,它返回超过2.2 an的文本数据。当我在浏览器(Chrome)中直接点击xquery文件时,它会加载所有的文本数据。
但是,当我尝试使用xdmp:http-post($url,$options)对该xquery文件进行post调用时,它抛出了XDMP-TOOBIG错误。下面是跟踪信息。
XDMP-TOOBIG: xdmp:http-post("http://server:8278/services/getText...", <options xmlns="xdmp:http"><timeout>600000</timeout><authentication method="basic"><usernam...</options>) -- Document size exceeds text document size limit of 2048 megabytes
in /services/invoke.xqy, at 20:7 [1.0-ml]
$HTTP_CALL = <configurations xmlns:config="" xmlns=""><credentails><username>admin</username><password>admin</password...</configurations>
$userName = text{"admin"}
$password = text{"admin"}
$timeOut = text{"600000"}
$url = "http://server:8278/services/getText..."
$responseType = "text/plain"
$options = <options xmlns="xdmp:http"><timeout>600000</timeout><authentication method="basic"><usernam...</options>
$response = xdmp:http-post("http://server:8278/services/getText...", <options xmlns="xdmp:http"><timeout>600000</timeout><authentication method="basic"><usernam...</options>)
$set-reponse-type = ()我可以在使用xdmp:http-post或其他解决方案的文件中指定任何限制吗?
感谢您的帮助。
发布于 2017-12-25 22:45:38
当使用超文本传输协议从MarkLogic内部调用外部服务器时,结果必须放入内存,可能有多个副本,具体取决于您所做的工作。文本变量没有针对非常大的数据进行优化。根据远程服务的详细信息,您可以通过使用分页的HTTP请求(使用Range Request Headers)来容纳大量数据
即使取消了2G限制,性能也会很差且不可靠:使用单个HTTP请求来传输大量数据变得越来越不可靠,因为任何严重的网络错误都需要完全重试。
或者,可以增强服务或本地代理服务,以将数据存储在共享位置,如挂载的文件系统或S3,并返回对数据的引用而不是其正文。然后可以使用xdmp:filesystem-xxx和xdmp:binary-xxx函数来访问数据。
一旦在内存中,将大型文本数据作为单个字符串进行操作也会出现问题。如果您需要访问单个大型对象,则可以使用二进制文档(内部或外部)以获得更好的可靠性。
如果HTTP请求可以转换为使用GET not POST,那么可以使用xdmp: document -load将结果直接流式传输到文档中。
xdmp:document-load文档上的评论建议可以使用"rest:“uri前缀作为POST或GET,将结果直接流式传输到数据库,尽管我不知道如何以这种方式传递POST。
https://stackoverflow.com/questions/36867412
复制相似问题