Chapter 7. Advanced Performance Strategies

In this chapter, we will look at some advanced strategies for improving the performance and scalability of production applications, through code as well as server architecture. We will explore options for running applications in multi-node server clusters, to spread out and handle user requests in a distributed fashion. We will also learn how to use sharding to help make our Lucene indexes faster and more manageable.

General tips

Before diving into some advanced strategies for improving performance and scalability, let's briefly recap some of the general performance tips already spread across the book:

  • When mapping your entity classes for Hibernate Search, use the optional elements of the @Field annotation to strip the unnecessary bloat from your Lucene indexes (see Chapter 2, Mapping Entity Classes):
    • If you are definitely not using index-time boosting (see Chapter 4, Advanced Mapping), then there is no reason to store the information needed to make this possible. Set the norms element to Norms.NO.
    • By default, the information needed for a projection-based query is not stored unless you set the store element to Store.YES or Store.COMPRESS (see Chapter 5, Advanced Querying). If you had projection-based queries that are no longer being used, then remove this element as part of the cleanup.
  • Use conditional indexing (see Chapter 4, Advanced Mapping) and partial indexing (Chapter 2, Mapping Entity Classes) to reduce the size of Lucene indexes.
  • Rely on filters to narrow your results at the Lucene level, rather than using a WHERE clause at the database query level (see Chapter 5, Advanced Querying).
  • Experiment with projection-based queries wherever possible (see Chapter 5, Advanced Querying), to reduce or eliminate the need for database calls. Be aware that with advanced database caching, the benefits might not always justify the added complexity.
  • Test various index manager options (see Chapter 6, System Configuration and Index Management), such as trying the near-real-time index manager or the async worker execution mode.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset