Search code examples
mavenmemorynexus

Sonatype Nexus uses more memory than allocated


On our server with 1 GB RAM, Nexus uses over 270 MB of it even though the repository itself at /usr/local/sonatype-work/nexus/storage is only 146 MB in size. Accordingly to https://support.sonatype.com/entries/25044341-Adjusting-memory-allocated-to-Nexus, I made the adjustments below in /usr/local/nexus/bin/jsw/conf/wrapper.conf and restarted the service. In htop, it still shows the usage as 274M however. Why doesn't this method work and is there another method of reducing the memory usage?

# Size Java memory, in MB (-Xms)
wrapper.java.initmemory=50
# Size Java memory, in MB (-Xmx)
wrapper.java.maxmemory=100

Solution

  • The maxmemory parameter only configures the maximum heap space for the JVM running the Nexus application on the built in Jetty server. That value does not set the maximum overall memory for the JVM.

    In any case setting it to 100MB only is very small and in my honest opinion not suitable for running Nexus. Keep in mind that Nexus does a lot of other things in memory like maintaining indexes and so on that are only partially related to the size of the storage of the repo on disc.