![]() ![]() | | +.instantiate(EntityPersister, Serializable) | 15 2 % | 0 | 99 | | | | +.tPropertyValues(Object, Object, EntityMode) | 15 2 % | 0 | 99 | | | | | +.assemble(Serializable, SessionImplementor, Object) | 250 37 % | 0 | 495 | | | | | +.assemble(Serializable, SessionImplementor, Object) | 281 42 % | 0 | 1,980 | ![]() | | | +.assemble(Serializable, Type, SessionImplementor, Object) | 531 79 % | 0 | 99 | | | | +.CacheEntry.assemble(Serializable, Object, Serializable, EntityPersister, Interceptor, EventSource) | 546 81 % | 0 | 99 | ![]() | | +.CacheEntry.assemble(Object, Serializable, EntityPersister, Interceptor, EventSource) | 546 81 % | 0 | 99 | | +.DefaultLoadEventListener.assembleCacheEntry(CacheEntry, Serializable, EntityPersister, LoadEvent) | 578 86 % | 0 | 99 | | +.DefaultLoadEventListener.loadFromSecondLevelCache(LoadEvent, EntityPersister, LoadEventListener$LoadType) | 671 100 % | 0 | 99 | | +.DefaultLoadEventListener.doLoad(LoadEvent, EntityPersister, EntityKey, LoadEventListener$LoadType) | 671 100 % | 0 | 99 | | +.DefaultLoadEventListener.load(LoadEvent, EntityPersister, EntityKey, LoadEventListener$LoadType) | 671 100 % | 0 | 99 | | +.DefaultLoadEventListener.onLoad(LoadEvent, LoadEventListener$LoadType) | 671 100 % | 0 | 99 | | +.CacheUpdatingLoadEventListener.onLoad(LoadEvent, LoadEventListener$LoadType) | 671 100 % | 0 | 99 | | +.fireLoad(LoadEvent, LoadEventListener$LoadType) | 671 100 % | 0 | 99 | | Name | Time (ms) | Own Time (ms) | Invocation Count | Is there something wrong with my OneToX mappings that makes initializing User entity particularly expense or is this just how costly proxying and I should rework my domain model to avoid having even 20 lazy relations off User? only 5% of time spent getting data from the 2nd level cache. I've confirmed that Hibernate isn't trying to fetch data for these OneToX relations, but merely initializing given User properties to Collection and Entity proxies.įor example, if I want to iterate over 99 Users (which are in 2nd level cache) and get their userNames 79% of time is spend on the above, v. 60% of CollectionType.assemble()'s time is spent in StatefulPersistenceContext.addUninitializedCollection(). Whenever a User entity is loaded (proxy actually initialized) via DefaultLoadEventListener.loadFromSceondLevelCache(), 79% of that method's time is spent in CollectionType.assemble() (20 invocations/User) and OneToOneType.assemble (5 invocations/User). Remember that a Map can't contain duplicate keys: void givenMap_whenEqualsAndHashCodeNotOverridden_thenMemoryLeak() 4.I have a User entity that has 20 OneToMany and 5 OneToOne relations - all lazy. If collections or large objects are declared as static, then they remain in the memory throughout the lifetime of the application, thus blocking vital memory that could otherwise be used elsewhere. So we need to pay very close attention to our usage of static variables. But this time, after we leave the populateList() method, all the memory of the list is garbage collected because we don't have any reference to it. The first part until the debug point is almost the same as what we obtained in the case of static. However, if we just drop the keyword static in line number 2 of the above program, then it'll bring a drastic change to the memory usage, as shown in this Visual VM response: If we analyze the Heap memory during this program execution, then we'll see that between debug points 1 and 2, the heap memory increased as expected.īut when we leave the populateList() method at the debug point 3, the heap memory isn't yet garbage collected, as we can see in this VisualVM response: Public static List list = new ArrayList()
0 Comments
Leave a Reply. |