sonatype/nexus-p2-repository-plugin — pull request #15 by cstamas (2012-06-27 18:17:30+00:00)
Title: P2 memory use optimizations.

Related to NXCM-4391 and others.

* In case of proxy repositories, DOMs were always loaded and persisted in way, that both, DOM and it's serialized for (as ByteArrayOutputStream) existed in memory (heap).
* In case of group repository, all of the DOMs were created at once, to have them merged. That means that count(members) + 1 merged DOM existed in memory (heap) after merge, and same serialization problem stood as for proxy repositories too.

My test case was 2 proxy repositories for Eclipse Indigo, and one P2 group having them both.

For measurements and verification used Nexus 2.1-SNAPSHOT on OSX Java (32bit), default pro bundle memory settings with following setup:

* two P2 proxies for Eclipse Indigo (remoteUrl: http://download.eclipse.org/releases/indigo/)
* one P2 group having both of them

All this just to handle large amounts of metadata (indigo repository is huge).

Results:

* before fix, Nexus was on "normal" heap size of 150-200MB while working, but it peaked at 850MB-900MB (and around 900MB OOMed) when merges happened at group level.
* afteer fix, "normal" heap sizes remained same, but peaks never went over 600MB, I had never OOM with "out of the box" memory sizing of Nexus pro.

Still, this is NOT the real fix, as real fix would involve more tweaking, as things are not yet ideal. DOM for group repository might still be huge (well,
same stands for proxy repositories too), so we probably need bigger change here...