Book Image

Building a RESTful Web Service with Spring

By : Ludovic Dewailly
Book Image

Building a RESTful Web Service with Spring

By: Ludovic Dewailly

Overview of this book

Table of Contents (17 chapters)
Building a RESTful Web Service with Spring
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Distributed caching


Beyond the caching techniques that we discussed in Chapter 6, Performance, which help improve the overall latency of a RESTful web service, other caching approaches can be employed to improve the scalability of such a service.

Data-tier caching

Service designers can choose to add a caching layer on top of the database. This is a common strategy for improving (read) throughput. In our sample property management system, we use Hibernate to access the database. Hibernate offers two different levels of caching. They are discussed next.

First-level caching

This level is built into Hibernate as a means of reducing SQL update statements being issued. This is an in-memory cache that requires no specific setup.

Second-level caching

The second level of caching is optional and fully configurable. The caching strategy to employ can be defined per entity and multiple providers are supported out of the box: