I'm experiencing a very weird problem with userstore_tokenperm clerk recently.
We have an environment with some databases in contained mode executing in version SQL Server 2017. Anyway i'm facing this problem since the SQL Server 2016.
At a certain moment this cache starts to grow at a rate of 6GB by day. When this ocurr we have to do a failover and restart the principal node of AG.
Run DBCC FREESYSTEMCACHE ('TokenAndPermUserStore') does not clear the cache. We are considering to use the trace flags 4621 as suggested by microsoft to avoid this memory pressure, but i want to know if someone has a tip to help me to understand this behavior. This seems like a memory leak, because even running DBCC FREESYSTEMCACHE the objects are not released from memory.
We have around to 70 users in contained mode in this server and when the cache starts to grow it grow until starve the server for memory.
In sys.dm_os_memory_clerks we already faced more than 30GB of consumption
Someone please can help with some troubleshooting hint or even with an experience about this kind of problem.
Thks in advance