I'm running an orchestration in BizTalk server 2016, with a 2-way WCF Receive Port (IIS), and a SAP adapter Send Port, to run a light query in SAP. I'm trying to optimize performance.
My question is: when I call my Orchestration for the first time (after I restart the Host instance) the first call takes around 1 second which I understand is because it's loading the assemblies into memory. The subsequent calls are much faster and take around 200-300 ms. But, exactly 1 minute after the first call, the next call takes 1 second again. The pattern is:
1st call 1 s
new call 300 ms
new call 300 ms
...
new call 1 s (1 minute after the first call)
new call 300 ms
new call 300 ms
...
It's like something is being cleared from memory after 1 minute but I cannot understand why? I have tweaked the config file so the assemblies never unload from memory and I have the pooling of messages and orchestrations down to 50ms.
Is there any other configuration I need to change?
The Orchestration AppDomain tears itself down every once in a while if it's not active.
If you look into the docs here, there are options for configuring how often this happens, specifically this section seems to be what you're looking for:
Just be warned that this really should be thoroughly tested (particularly testing it under normal production loads for several hours at a time at least). It may produce other unwanted side effects around memory usage and overall performance. Is 1 second really too high a price to pay every so often in your scenario?