我的XXX.xqy
中有一个简单的代码,用于在 Marklogic 中保存文档。
第一次保存请求总是比后续请求花费更多时间。
我尝试使用trace()
,它显示保存在不到1毫秒内完成,但要完成请求需要时间。
我的xdmp:document-insert()
中只有XXX.xqy
声明。
我们可以在jmeter负载测试中看到相同的结果,第一个请求需要大约600ms的时间,而不是下降到3-6 ms。
ML是否第一次编译代码? 有没有办法预编译代码?
答案 0 :(得分:1)
It could be because of the module cache. The first time you run a module it will compile the module. There is a life time on the cache too see https://docs.marklogic.com/admin:group-set-module-cache-timeout