It was noticed in a production instance under high request load for NPM and NuGet repositories and a large component database that java.lang.OutOfMemoryError were occurring on a regular basis, despite recommended heap and direct memory settings.
Upon heap dump analysis, internal structures related to database queries were consuming a disproportionate amount of heap memory.
Turns out that the default cursor prefetch limit when not explicitly set in code by a query is set to 500000 by default. This loads a large number of query results into memory, despite the application knowing ahead of time that far fewer results are needed.
- all internal queries should set explicit query limits ( NEXUS-14842 )
- the default prefetch limit if a query does not set an explicit limit should be a much smaller default ie. 10000
Customers not yet upgraded to a fixed version of repository manager can set a much smaller query limit explicitly.
Add the following lines to the end of the file:
Restart Nexus to pick up the change.