Chapter 4. Caching

When you are faced with a performance hot spot, you have basically two options. You could delve into the nitty-gritty details of the computation or find a clever way to avoid the computation altogether. The latter option is the preferred way to go since avoiding a costly computation is likely to be much faster than optimizing it. Computational values tend to fall into three categories according to their expected lifetimes:

  • Static—. These values do not change at all during the life of the application. For example, a Web server returns its own name on every response header. The name of the server will not change for the duration of server execution.

  • Pure dynamic—. These values could change at any point in time and must be recomputed ...

Get Java™ Performance and Scalability, Volume 1: Server-Side Programming Techniques 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.