BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Article: Using ETags to Reduce Bandwith & Workload with Spring & Hibernate

Article: Using ETags to Reduce Bandwith & Workload with Spring & Hibernate

In this article, Gavin Terrill explores one of the lessor known facilities available to web application developers, the humble "ETag Response Header", and how to integrate its use in a Spring Framework dynamic web application to improve application performance and scalability.

Read  Using ETags to Reduce Bandwith & Workload with Spring & Hibernate.

Gavin created a sample app based on Spring's "petclinic" bundled with his eTag caching framework.   Gavin uses a Spring MVC HTTP Request interceptor to apply ETag comparison logic to find if the data that is used to build a page hasn't changed, to avoid further processing.  For the purposes of this article, he created a simple ModifiedObjectTracker that keeps track of insert, update and delete operations via Hibernate event listeners. The tracker keeps a unique number for each view in the application, and a map of what Hibernate entities impact each view. Whenever a POJO is changed a counter is incremented for the views that the entity is used in. Gavin uses the count as the ETag, so when the client sends it back we know if one of the objects behind the page has been modified.

Have you tried using ETags to implement a content page caching framework?

Rate this Article

Adoption
Style

BT