EclisepLink L2 cache When does its content in it get removed

We recently encountered a issue in our application in production environment. We updated our application version in production environment and ever since there were more queries going to DB. No change itself were made in Application concerning any additional queries. There are some days where these additional queries were not sent and some days where these additional queries were sent to DB. We enabled eclipselink jpa logging to find that the entitymanager.find on some days results in additional call to database where on some days the data seems to be returned from cache istead of Db call. I assume that this is the eclipselink L2 cache which holds this data and when cache miss occurs db query is fired. Am i correct in the above statement? If my above statement is correct, then what are the reasons why on some days the data what application is looking for is missing in cache? We have not done any additional code to clear any cache to our knowledge? Also where exactly whould this L2 cached data be present? Would it be in Heap memory? What effect would Garbage collection have on this L2 cache?

Answers


There are a number of Docs on the EclipseLink site that go into more detail on its caching and how it works. I'd suggest you check out https://www.eclipse.org/eclipselink/documentation/2.4/concepts/cache001.htm and https://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Caching/Configuring first and then ask your specific questions, and there are many reasons why something might be in the cache on one day and not on the next depending on the settings. By default, the shared L2 cache uses as soft cache and weak identity map references, so objects no longer referenced by the application can be garbage collected.


Need Your Help

Saving multiple entities using ASP.NET MVC3

c# asp.net-mvc-3

I have a view that takes in an IEnumerable<User> and for every user it pumps out an editor with a save button at the bottom of the page. My post action takes in an IEnumerable<User> but...

How to get the hidden element value in Protractor.NET?

c# selenium selenium-webdriver protractor protractor-net

I have an input type hidden which stores a primary key id. How can I get the hidden type value? Is that possible to get the value using Protractor.NET?