• Complain

Anghel Leonard - Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications

Here you can read online Anghel Leonard - Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2020, publisher: Apress, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Anghel Leonard Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications
  • Book:
    Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications
  • Author:
  • Publisher:
    Apress
  • Genre:
  • Year:
    2020
  • Rating:
    4 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 80
    • 1
    • 2
    • 3
    • 4
    • 5

Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

This book is a collection of developer code recipes and best practices for persisting data using Spring, particularly Spring Boot. The book is structured around practical recipes, where each recipe discusses a performance case or performance-related case, and almost every recipe has one or more applications. Mainly, when we try to accomplish something (e.g., read some data from the database), there are several approaches to do it, and, in order to choose the best way, you have to know the implied trades-off from a performance perspective. Youll see that in the end, all these penalties slow down the application. Besides presenting the arguments that favor a certain choice, the application is written in Spring Boot style which is quite different than plain Hibernate. Persistence is an important set of techniques and technologies for accessing and using data, and this book demonstrates that data is mobile regardless of specific applications and contexts. In Java development, persistence is a key factor in enterprise, ecommerce, cloud and other transaction-oriented applications. After reading and using this book, youll have the fundamentals to apply these persistence solutions into your own mission-critical enterprise Java applications that you build using Spring. What You Will Learn Shape *-to-many associations for best performances Effectively exploit Spring Projections (DTO) Learn best practices for batching inserts, updates and deletes Effectively fetch parent and association in a single SELECT Learn how to inspect Persistent Context content Dissect pagination techniques (offset and keyset) Handle queries, locking, schemas, Hibernate types, and more Who This Book Is For Any Spring and Spring Boot developer that wants to squeeze the persistence layer performances.

Anghel Leonard: author's other books


Who wrote Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications? Find out the surname, the name of the author of the book and a list of all author's works by series.

Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Contents
Landmarks
Anghel Leonard Spring Boot Persistence Best Practices Optimize Java - photo 1
Anghel Leonard
Spring Boot Persistence Best Practices
Optimize Java Persistence Performance in Spring Boot Applications
Anghel Leonard Banesti Romania Any source code or other supplementary - photo 2
Anghel Leonard
Banesti, Romania

Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the books product page, located at www.apress.com/9781484256251 . For more detailed information, please visit http://www.apress.com/source-code .

ISBN 978-1-4842-5625-1 e-ISBN 978-1-4842-5626-8
https://doi.org/10.1007/978-1-4842-5626-8
Anghel Leonard 2020
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.
Distributed to the book trade worldwide by Apress Media, LLC, 1 New York Plaza, New York, NY 10004, U.S.A. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.

This book is dedicated to my dear wife, Octavia.

Introduction
In a nutshell, this book is a collection of best practices for Java persistence performance in Spring Boot applications. These practices have been exposed via 120+ items, and they can be grouped into three categories:
  • First, we discuss the best practices for defining entities, mapping relationships, writing queries, fetching data, choosing identifiers generators, and so on. Mainly, we cover the areas where Spring Boot cannot help you with built-in artifacts and where you can avoid important performance penalties that are hard to fix and may require significant changes in your domain model.

  • Second, we address best practices for using Spring Boot support (more precisely, Spring Data). As you will see, relying on built-in support as a silver bullet can come with performance penalties. For example, using the Open Session in View, offset pagination, post-commits hooks, or misunderstanding @Transactional are just a few of the covered topics. Im pretty sure that you are ready and impatient to jump into this category of items.

  • Third, we deep dive into several Hibernate goodies that can sustain the performance of your applications. By default, Spring Data relies on Hibernate as its persistence provider, therefore you can exploit Hibernate via Spring Data, and you can exploit underlying Hibernate goodies as well. Goodies such as populating a child-side parent association via a Hibernate proxy, using Dirty Tracking, delaying connection acquisition, lazy loading attributes, and using natural keys are just a few of the covered items.

The prerequisites of this book are pretty intuitive. Youll need an IDE (e.g., NetBeans, Eclipse, IntelliJ IDEA, Visual Studio, etc.), MySQL, and PostgreSQL. Optionally, you may install or use other database vendors as well (e.g., Oracle, SQL Server, etc.).

As you will see, I prefer to add @Repository annotation at repository interface level. Is well-known that @Repository is useful for translating the unchecked SQL specific exception to Spring exceptions. This way, we have to handle only DataAccessException (and its subclasses).

Nevertheless, this is a valid statement in general when we use Spring, but Spring Data repositories are already backed by a Spring proxy. In other words, using @Repository doesnt make any difference. I prefer to use it for avoiding any confusions and simpy highlight the repository interfaces, but if you consider this too verbose or just noise then feel free to remove it.

In an overwhelming percentage the examples used in this book uses Hibernate JPA. In other words, we boostrap Hibernate as the JPA provider which is the most common use case in Spring Boot applications that uses Spring Data JPA. If your Sping Boot (Spring) application boostraps Hibernate nativelly (e.g., via SessionFactoryBuilder , BootstrapServiceRegistryBuilder , SessionRegistry , Configuration , HibernateTransactionManager , etc.) then, depending on the case/scenario, you may notice different behaviors.

In this book, when you encounter Hibernate-specific or Hibernate ORM then I refer to something that doesnt exist in JPA (exist only in Hibernate) and it might not be that obvious in the corresponding context.

For brevitys sake and in order to avoid cluttering the climax of topics you will see several shortcomings in code that should be avoided in production as follows:
  • hard-coded identifiers (primary keys) or other data that is a good candidate for being arguments of metods

  • usage of orElseThrow() for unwrapping Optional objects (I prefer this approach because it quicky signals if is something wrong with finding/loading the requested data)

  • maybe something else that I forgot to mention here

Main performance penalties
Use eager fetching
  • Items: 1-5, 7, 8, 9, 23, 24

Dont prevent/fix N+1 issues
  • Items: 6-9, 23, 24, 39-41, 43, 56, 66, 67, 81, 108

Fetch more data than needed
  • Items: 10, 12, 21, 23-38, 42, 43, 45, 56, 57, 97, 98, 105, 128

Update/deletes huge lists of elements one-by-one
  • Items: 6, 51-53, 59, 109, 126, 129

Use entities for read-only operations
  • Items: 16, 22, 25-38, 42, 43, 56, 57, 95, 96

Implement low-performing batching
  • Items: 46-55

Implement low-performing associations
  • Items: 1-5, 11, 12, 14, 75, 76, 80

Use Open Session in View
  • Items: 23, 110

Use low-performing identifiers
  • Items: 55, 65-76

Use low-performing pagination
  • Items: 44, 94-102

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications»

Look at similar books to Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications»

Discussion, reviews of the book Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.