Home » Author Archives: Vlad Mihalcea

Author Archives: Vlad Mihalcea

Vlad Mihalcea is a software architect passionate about software integration, high scalability and concurrency challenges.

How to monitor a Java EE DataSource

java-interview-questions-answers

Introduction FlexyPool is an open-source framework that can monitor a DataSource connection usage. This tool come out of necessity, since we previously lacked support for provisioning connection pools. FlexyPool was initially designed for stand-alone environments and the DataSource proxy configuration was done programmatically. Using Spring bean aliases, we could even substitute an already configured DataSource with the FlexyPool Metrics-aware proxy ...

Read More »

How does Hibernate Query Cache work

jboss-hibernate-logo

Introduction Now that I covered both Entity and Collection caching, it’s time to investigate how Query Caching works. The Query Cache is strictly related to Entities and it draws an association between a search criteria and the Entities fulfilling that specific query filter. Like other Hibernate features, the Query Cache is not as trivial as one might think. Entity model ...

Read More »

How does Hibernate READ_WRITE CacheConcurrencyStrategy work

jboss-hibernate-logo

Introduction In my previous post, I introduced the NONSTRICT_READ_WRITE second-level cache concurrency mechanism. In this article, I am going to continue this topic with the READ_WRITE strategy. Write-through caching NONSTRICT_READ_WRITE is a read-through caching strategy and updates end-up invalidating cache entries. As simple as this strategy may be, the performance drops with the increase of write operations. A write-through cache ...

Read More »

How does Hibernate NONSTRICT_READ_WRITE CacheConcurrencyStrategy work

jboss-hibernate-logo

Introduction In my previous post, I introduced the READ_ONLY CacheConcurrencyStrategy, which is the obvious choice for immutable entity graphs. When cached data is changeable, we need to use a read-write caching strategy and this post will describe how NONSTRICT_READ_WRITE second-level cache works. Inner workings When the Hibernate transaction is committed, the following sequence of operations is executed: First, the cache ...

Read More »

How does Hibernate Collection Cache work

jboss-hibernate-logo

Introduction Previously, I described the second-level cache entry structure, Hibernate uses for storing entities. Besides entities, Hibernate can also store entity associations and this article will unravel the inner workings of collection caching.       Domain model For the up-coming tests we are going to use the following entity model: A Repository has a collection of Commit entities: @org.hibernate.annotations.Cache( ...

Read More »

How to optimize Hibernate EllementCollection statements

jboss-hibernate-logo

Introduction Hibernate supports three data mapping types: basic (e.g String, int), Embeddable and Entity. Most often, a database row is mapped to an Entity, each database column being associated to a basic attribute. Embeddable types are more common when combining several field mappings into a reusable group (the Embeddable being merged into the owning Entity mapping structure). Both basic types ...

Read More »

How does Hibernate READ_ONLY CacheConcurrencyStrategy work

jboss-hibernate-logo

Introduction As I previously explained, enterprise caching requires diligence. Because data is duplicated between the database (system of record) and the caching layer, we need to make sure the two separate data sources don’t drift apart. If the cached data is immutable (neither the database nor the cache are able modify it), we can safely cache it without worrying of ...

Read More »

A beginner’s guide to Cache synchronization strategies

software-development-2-logo

Introduction A system of record is the authoritative data source when information is scattered among various data providers. When we introduce a caching solution, we automatically duplicate our data. To avoid inconsistent reads and data integrity issues, it’s very important to synchronize the database and the cache (whenever a change occurs into the system). There are various ways to keep ...

Read More »

Things to consider before jumping to enterprise caching

java-interview-questions-answers

Introduction Relational database transactions are ACID and the strong consistency model simplifies application development. Because enabling Hibernate caching is one configurations away, it’s very appealing to turn to caching whenever the data access layer starts showing performance issues. Adding a caching layer can indeed improve application performance, but it has its price and you need to be aware of it. ...

Read More »

How does Hibernate store second-level cache entries

jboss-hibernate-logo

Introduction The benefit of using a database access abstraction layer is that caching can be implemented transparently, without leaking into the business logic code. Hibernate Persistence Context acts as a transactional write-behind cache, translating entity state transitions into DML statements. The Persistence Context acts as a logical transaction storage, and each Entity instance can have at-most one managed reference. No ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close