Java Persistence Performance Illustrated Guide
Java Persistence Performance Illustrated Guide
$20.99
Minimum price
$23.99
Suggested price
Java Persistence Performance Illustrated Guide

This book is 85% complete

Last updated on 2018-04-23

About the Book

This book covers the most common and dangerous performance issues related to the persistence layer: Hibernate, JPA, SQL, JDBC and Hazelcast (check out the book sample). Each performance recipe has a short and condensed description and a "handmade" image that will expose the issue and the potential approaches to avoid it.

Table of Contents

Introduction

SQL

Lifecycle

SQL statement lifecycle

Indexes/statements

Using functions in the WHERE clause

Why the index column order matters

Primary key vs. Unique key

LIKE vs. equal (=)

LIKE wildcards usage

UNION vs. UNION ALL and JOIN flavors

RDBMS Headlines

Scaling

Master-slave replication

Multi-master replication

Sharding

Throughput and response time

Connections

JDBC DriverManager and DataSource

Using a connection pool

Spring post-commit hooks and connection release

Detect database connection leaks

Little's law

Result Set

Limit the result set

Result set scrollability

Transactions

Atomicity (ACID)

Consistency (ACID)

Isolation (ACID)

Durability (ACID)

Deadlock

Non-repeatable reads vs. repeatable reads

Two-phase locking (2PL)

Dirty read

Dirty write

Lost update

Phantom read

Read skew

Write skew

Read Uncommitted

Read Committed

Repeatable Reads

Serializable

JPA & Hibernate

Identifiers

Choose between identifiers generation strategies

The equals() and hashCode() methods

The hi/lo algorithm

Querying

DTOs

Hibernate simple SELECT

Using Criteria API

Hibernate and SQL native queries

Show and slow SQLs

Java 8 Date/Time mapping

6 Ways to delete objects with Hibernate

The JDBC, java.sql.Statement

The JDBC, java.sql.PreparedStatement

Fetching and Loading

Hibernate attributes lazy fetching

Hibernate and JPA fetching entities

Hibernate fetching size

Hibernate loading entities

Direct fetching

Fetching a Proxy reference

Populating a child-side parent association via Proxy

Read only data

Index scan in offset and seek (paging)

N+1

Hibernate HINT_PASS_DISTINCT_THROUGH

Streaming results via Java 8 and Spring Data JPA 1.8

Using Optional in entities

Batching

Hibernate batching

Bulk vs. batch

Hibernate setup batching

Flushing

JPA & Hibernate entity state transitions

Hibernate auto flush

Hibernate dirty checking

Hibernate flushing order

JPA @EntityListeners with callbacks

Relationships

The bidirectional @OneToMany association

JPA/Hibernate @MapsId and unidirectional @OneToOne

Using collection relationships

@ElementCollection

@OneToMany association and insert entities

@OneToMany association and delete entities

6 Best practices for one-to-many and many-to-one associations

Many-to-many and cascade type

Unidirectional @ManyToMany

Unidirectional @ManyToMany Persist & Remove

Bidirectional @ManyToMany

Inheritance

JPA Single Table Inheritance Strategy

JPA Joined Subclass Inheritance Strategy

JPA Table per Class Inheritance Strategy

@MappedSuperclass

Transactions

Read-only transactions in Spring and Hibernate

Hibernate 5.2.10 get connection as needed

Use @Transactional on repository or on service

Concurrency

Optimistic locking

LockModeType.OPTIMISTIC_FORCE_INCREMENT

LockModeType.PESSIMISTIC_FORCE_INCREMENT

Caching

Hibernate second level cache concurrency strategies

Immutable entities and Second Level Cache (SLC)

Exceptions

Hibernate LazyInitializationException

Hazelcast

IDs

Generating cluster-wide unique IDs

Distributed Map

Hazlecast in-memory format

The 12 IMap performance tips

Concurrency

Hazelcast pessimistic locking

About the Author

Anghel Leonard
Anghel Leonard

Anghel Leonard is a CA interested in Java performance

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Write and Publish on Leanpub

Authors and publishers use Leanpub to publish amazing in-progress and completed ebooks, just like this one. You can use Leanpub to write, publish and sell your book as well! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub