Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-14843

cursor prefetch limit set to high by default for some queries potentially leading to excessive memory usage

    XMLWordPrintable

    Details

      Description

      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.

      Expected

      • 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

      Work Around

      Customers not yet upgraded to a fixed version of repository manager can set a much smaller query limit explicitly.

      Edit <app-dir>/etc/karaf/system.properties

      Add the following lines to the end of the file:

      # orientdb: NEXUS-14843
      index.cursor.prefetchSize=10000

      Restart Nexus to pick up the change.

        Attachments

          Activity

            People

            Assignee:
            nblair Nicholas Blair
            Reporter:
            plynch Peter Lynch
            Last Updated By:
            Peter Lynch
            Team:
            Nexus - Platform
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response:

                tigCommentSecurity.panel-title