I'm currently working on SQL Server 2017 - Here's the @@version:
Microsoft SQL Server 2017 (RTM-CU20) (KB4541283) - 14.0.3294.2 (X64) Mar 13 2020 14:53:45 Copyright (C) 2017 Microsoft Corporation Enterprise Edition (64-bit) on Windows Server 2016 Datacenter 10.0 <X64> (Build 14393: )
We keep getting jobs failing with error messages very similar to this:
2021-03-16 06:11:32.7483 -07:00 Error: .NET Framework execution was aborted. Another query caused the AppDomain Market.dbo[runtime].41 to be unloaded.
It also seems that several jobs fail with this error about the same time, and they all use CLR assemblies.
Obviously, there's a memory usage issue. We don't believe there is anything wrong with the code, however, we believe the assembly that is causing the issues is one that uses the HttpClient class. The procedure that calls this assembly typically calls the CLR function about 300 times in quick succession when it's run. To further complicate things, two copies of the stored proc are run simultaneously for greater throughput, for a total of about 600 calls to the CLR assembly in a short period of time.
Does anyone have any suggestions for how we can monitor memory usage by this specific assembly?
Is there a way to allocate more memory for the CLR assemblies?
Any other suggestions as to how we can make this more reliable?