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 ...

Get Building a RESTful Web Service with Spring now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.