Release Notes: Codenvy 5.11

We have improved the resource utilization of Codenvy by enabling string deduplication in the workspace agent. As a result, the memory used by workspace agent has been reduced, which improves workspace start time in some cases.

String deduplication is a feature from Java 8 Update 20. Strings usually consume a lot of memory, especially for char[] which consume up to two bytes for each characters. String deduplication takes advantage of the fact that the char arrays are internal to strings and final, so the JVM can optimize them without concern.

Here is how it works:

String class keeps string value in char[] array, next to the hash. The char array is not observable from outside and String class itself doesn’t modify the contents of the array, this means that char array can be used safely by multiple instances of String at the same time.

In order to enable string deduplication we have configured the JVM of the worskpace agent to use the newer G1 garbage collector.

Here is brief comparative result between previous and new Java settings.

All screenshots taken on workspace with an medium-sized Java + Maven project, loaded and idling about 15 mins.

Fig.1 – Difference in total memory consuming right after GC action.
Note used memory value 50 vs 40 Mb.

Previous: used memory = 50 MB. Now: used memory = 40 MB

Fig.2 – Difference in total memory consuming.
Note that G1GC decreases heap size.

Previous: heap memory 600MB Now: heap memory 140MB

Fig. 3 – Memory by classes.
Note significant reduction of the char[] objects size.

Previous: 128 00 instances for 15 200KB. Now: 70 00 instances for 10 613KB.

Learn more in the following issue.

Continue reading

This post was originally published on this site