...
Creating objects in Java is trivial. In fact, it can be described as being too easy to create objects. When a user logs into uPortal for the first time, over 40MB of objects are created (depending on channel content). The resulting number of objects is much lower than 40MB, but creating over 40MB of objects (most being temporary) in a few seconds is an expensive process. Though the Java Garbage Collector (GC) has made great strides in performance over the past few years, especially in regards to temporary object creation, reducing the large number of objects created can only increase overall application performance.
The following image shows a few hotspots captured from the uPortal 2.4.2 quickstart:
The following steps were performed to capture the data:
- start the server and attach YourKit profiler
- login once and exit
- have YourKit start collecting object counts
- login once and exit
- snapshot
- login once and exit
- snapshot
- compare snapshots
There is much data generated by YourKit, but the image shows the excessive number of objects created by two uPortal-code methods (addressed below). The interesting number is the 240k objects created to render the two pages (on login and logout). Of these, almost 110k were created by the two methods shown (approx 2MB out of 14.5MB).
isDebugEnabled()
Tracing is commonly found in application code. It will usually look like:
...