Equinox p2 Repository Optimization
p2 artifact repositories can hold many different forms of the same artifact. For example, a JAR artifact may exist as
- a canonical (unmolested) JAR
- a compressed JAR (assuming the original was not compressed)
- a pack200 JAR
- a delta relative to another version of the artifact
This document outlines the behavior of p2 in the various scenarios and details how to populate a repository with a optimized forms of artifacts.
Pack200 is a standard part of Java 5. It is a rather radical compression algorithm that is class file aware. It typically results in approximately 70% smaller JARs assuming the JARs are mostly code. Pack200 has no effect on non-class files. Packed JARs can be supplied by the client populating a repository or added after the fact by running the Pack 200 repository optimizer. See the org.eclipse.equinox.p2.repositoryoptimizer bundle.
That project includes a simple optimizer application that, when pointed at an artifact repository, packs all "plugin" artifacts it can find. There is also a handy launch configuration you can use to run the application.
Once the repository has been optimized, any agent pointing at the repository will automatically choose to download the packed form of the artifact if the repository is not local to the agent. In the case of local repositories it is more efficient to simply copy the canonical form if available.
Note that the agent running must have the org.eclipse.equinox.p2.jarprocessor bundle installed and resolved.
Class Delta Optimization
When JARs change often only a few classes in them change. The difference between two JARs can then be captured as a set of deletions, replacements and additions. These can themselves be contained in a JAR. That JAR is called a "delta JAR". The delta JAR can itself be packed, signed, ... since it is just a normal JAR.
To be implemented...
Full Delta Optimization