Abhi
Abhi

Reputation: 21

Marklogic:First request to marklogic takes time

I have a simple code in my XXX.xqy to save document in Marklogic. First request to save always takes more time than subsequent request.

I tried to use trace(), it shows saving is done in less than 1ms, but to complete request it takes time.

I just has xdmp:document-insert() statement in my XXX.xqy.

we can see the same result in jmeter load test, first request takes time around 600ms than it drops to 3-6 ms.

Does ML compiles code first time? Is there any way to precompile the code?

Upvotes: 1

Views: 171

Answers (1)

Tyler Replogle
Tyler Replogle

Reputation: 1339

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

Upvotes: 1

Related Questions