MarkLogic version 9.0-6.2
I have a custom rest GET service that takes an ID (lets say PolicyId) and returns a document (only 1 document returned always). Element Range index is created on PolicyId. I have 100 different documents, one for each PolicyId.
When I call the service through SoapUI tool the first time with a PolicyId, I see a response time of around 2 sec, but from the second call onward (even if I try with a different PolicyId), I see a response time of around 30 milliseconds.
Now, if I close SoapUI tool and retry the above steps after 1 hour, again I see a response time of 2 sec for the first call.
I am trying to understand the behavior and its relation to caching in MarkLogic. Why am I getting slower response the first time? How am I getting faster response from second time onward even if I give a different PolicyId? Is there a way we can improve the performance for the very first call itself? Any suggestion on better performance tools for REST APIs?
Any inputs are highly appreciated.