We are facing a performance issue in a custom service in Sonic 8.0. The custom service is taking 0 ms to 1000 ms for processing each request. We did testing by publishing 5K messages. Same message was published for every request.

By debugging line by line, it was observed that most of the time is spent for reading the runtime parameter. Say, if a request takes 50 ms to get process, 45 ms is taken for reading the runtime parameter itself. This time is varying for each request (0-1000 ms) and thus causing a variation in processing time of each request.
The runtime parameter is read using the below code where argContext is the ServiceContext. Path of a xml file is given in the runtime parameter. ie sonicfs:///workspace/configs/enrichments/merge.esbrf and we will get the xml file as string in routingFileContents variable in the below code.

long startTime = System.currentTimeMillis();

String routingFileContents = argContext.getParameters()getParameter("EnrichmentFile", XQConstants.PARAM_STRING );

long timeTaken = System.currentTimeMillis()-startTime)

Here timeTaken is varying for each request.Most of the request is taking 600 ms – 900 ms for reading the parameter while some request read it in just 0 ms.
To debug more, I have created a custom service that only does reading the run time parameter using the same API mentioned above.Here what I observed is for the first request its taking nearly 60 ms(max so far seen) and for the rest its less than 1 ms.This is different from what is happening with the other custom service  where the time of exceution is more for all the requests.
Any comment in this regard will be very helpful.
Thanks in advance,