NEXUS-21138 implemented lazy rebuilding of Maven GA level maven-metadata.xml files to avoid a problem where maven-metadata.xml was not available for the length of time needed to rebuild. NEXUS-22666 corrected a problem where some deploys under concurrent access immediately failed with 500 response due to the first transaction failing and transaction retries not being present.
As a consequence of the above changes, if the number of assets needed to be queried is high (most directly corresponding to numbers of versions as seen in certain SNAPSHOT deployment models) for a given GA and those versions are under frequent updates, then this could lead to a database transaction left open for a significant period of time. This transaction can consume a large amount of memory, causing an NXRM instance to swap or garbage collect much more frequently than versions prior to 3.20.1. The long database transaction will also have other side effects such as limiting the overall transactions available for any type of db operations and blocking other related threads trying to access the same metadata.
Avoid keeping transactions open for a long time, mitigating the symptoms these other issues have introduced.