Hands-On High Performance with Spring 5
eBook - ePub

Hands-On High Performance with Spring 5

Techniques for scaling and optimizing Spring and Spring Boot applications

Chintan Mehta, Subhash Shah, Pritesh Shah, Prashant Goswami, Dinesh Radadiya

Condividi libro
  1. 408 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Hands-On High Performance with Spring 5

Techniques for scaling and optimizing Spring and Spring Boot applications

Chintan Mehta, Subhash Shah, Pritesh Shah, Prashant Goswami, Dinesh Radadiya

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

A hands-on guide to creating, monitoring, and tuning a high performance Spring web application

Key Features

  • Understand common performance pitfalls and improve your application's performance
  • Build and deploy strategies for complex applications using the microservice architecture
  • Understand internals of JVM - the core of all Java Runtime Environments

Book Description

While writing an application, performance is paramount. Performance tuning for real-world applications often involves activities geared toward detecting bottlenecks. The recent release of Spring 5.0 brings major advancements in the rich API provided by the Spring framework, which means developers need to master its tools and techniques to achieve high performance applications.

Hands-On High Performance with Spring 5 begins with the Spring framework's core features, exploring the integration of different Spring projects. It proceeds to evaluate various Spring specifications to identify those adversely affecting performance. You will learn about bean wiring configurations, aspect-oriented programming, database interaction, and Hibernate to focus on the metrics that help identify performance bottlenecks. You will also look at application monitoring, performance optimization, JVM internals, and garbage collection optimization. Lastly, the book will show you how to leverage the microservice architecture to build a high performance and resilient application.

By the end of the book, you will have gained an insight into various techniques and solutions to build and troubleshoot high performance Spring-based applications.

What you will learn

  • Master programming best practices and performance improvement with bean wiring
  • Analyze the performance of various AOP implementations
  • Explore database interactions with Spring to optimize design and configuration
  • Solve Hibernate performance issues and traps
  • Leverage multithreading and concurrent programming to improve application performance
  • Gain a solid foundation in JVM performance tuning using various tools
  • Learn the key concepts of the microservice architecture and how to monitor them
  • Perform Spring Boot performance tuning, monitoring, and health checks

Who this book is for

If you're a Spring developer who'd like to build high performance applications and have more control over your application's performance in production and development, this book is for you. Some familiarity with Java, Maven, and Eclipse is necessary.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Hands-On High Performance with Spring 5 è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Hands-On High Performance with Spring 5 di Chintan Mehta, Subhash Shah, Pritesh Shah, Prashant Goswami, Dinesh Radadiya in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Informatique e Programmation en Java. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2018
ISBN
9781788830638
Edizione
1
Argomento
Informatique

Spring Boot Microservice Performance Tuning

In the previous chapter, we learned about Java Virtual Machine (JVM). Starting with the internals of JVM and Java's class-loading mechanism, we learned how memory management is performed in Java. The last section of the chapter focused on garbage collection and JVM tuning. The chapter was full of pretty important details for application performance optimization.
In this chapter, we will move toward solving performance problems. The approach is to develop microservices. Microservices are having a boom in the software development industry right now. There is a lot of buzz around microservices and related keywords. This approach basically works at an application-architecture level to tune the application's performance. It describes how we can improve application performance by setting up the architecture in a different manner. We will cover the following topics in this chapter:
  • Spring Boot configuration
  • Metrics with the Spring Boot Actuator
  • Health checks
  • Microservices using Spring Boot
  • Microservices with Spring Cloud
  • Spring microservice configuration example
  • Monitoring microservices with Spring Boot admin
  • Spring Boot performance tuning

Spring Boot configuration

In this section, we will focus on making Spring Boot work for us. Before jumping on to Spring Boot configuration, we will understand what Spring Boot is, why we should use it, and what Spring Boot brings to the table. We will move quickly to the how to do it part of it.

What is Spring Boot?

It is necessary for software development processes to be faster, more accurate, and more robust. Software teams are asked to develop quick prototypes for showcasing the application's features to prospective clients. The same applies to production-grade applications. The following are a few areas where software architects focus on to improve the effectiveness of development teams:
  • Use the right set of tools, which includes frameworks, IDEs, and build tools
  • Reduce code clutter
  • Reduce the amount of time spent writing repetitive code
  • Spend the majority of the time implementing business features
Let's think for a moment. Why are we discussing this? The reason is that this is the foundation for Spring Boot. These thoughts are the founding stones for the creation of any framework or tool that helps teams to improve their productivity. Spring Boot is found with exactly the same reason—to improve productivity!
With Spring Boot, it becomes easy to create production-grade applications that are powered by the Spring Framework. It also makes it easy to create production-ready services with minimal challenges. Spring Boot helps new and existing users get to their productive tasks quickly by taking an opinionated view of the Spring Framework. Spring Boot is a tool that facilitates creating a standalone Java application, which can be run using the java -jar command, or a web application, which can be deployed to web servers. The Spring Boot setup is bundled with command-line tools to run Spring programs.
The major goals of Spring Boot are:
  • To gain an extremely fast experience to get started with Spring-powered projects
  • Broad accessibility
  • Major support from out-of-the-box configuration
  • Flexibility to deviate from Spring default as the need may arise
  • That it does not generate any code
  • That it does not require XML configuration
Along with previously listed primary features, Spring Boot also provides support for non-functional features, listed as follows:
  • Support for versioning and configuration for widely known and used frameworks
  • Support for application security
  • Support for monitoring application health check parameters
  • Support for monitoring of performance metrics
  • Support for externalized configurations
Though Spring Boot provides defaults for the primary and non-functional features, it is flexible enough to allow developers to use the frameworks, servers, and tools of their choice.

Spring Initializr

Spring Boot applications can be kickstarted in multiple ways. One of the ways is to use the Eclipse-based Spring Tools Suite IDE (https://spring.io/tools/sts). Another way is to use https://start.spring.io, also known as Spring Initializr. First things first, Spring Initializr is not Spring Boot or an equivalent. Spring Initializr is a tool that has simple web UI support to configure the Spring Boot application. It can be considered a tool for a quick-start generation of Spring projects. It provides APIs that can be extended for customization in order to generate the projects.
The Spring Initializr tool provides a configuration structure to define a list of dependencies, supported Java and Spring Boot versions, and supported dependency versioning.
Basically, Spring Initializr creates an initial Spring project based on the configuration provided and allows the developer to download the project in a ZIP file. Here are the steps to be followed:
  1. Navigate to https://start.spring.io/.
  2. Choose the dependency management tool from Maven or Gradle.
  3. Choose the JVM-based programming language from Java, Kotlin, and Groovy.
  4. Choose the Spring Boot version to be used.
  5. Provide the Group artifact by inputting the group name as com.packt.springhighperformance.
  1. Input Artifact, which is the artifact ID for the Maven project. This will become the name of the project WAR or JAR file to be deployed or executed.
  2. Choose a packaging type from Jar and War.
  3. Click on the Switch to the full version link. This will open up a list of starter projects to choose from. The starter project will be explained in detail in the following section.
  4. Once we have chosen the starters or dependencies, click on the Generate Project button. This will download the ZIP file containing the initial project configuration.
The following is the Spring Initializr screen with a few configurations:
Once done, a folder structure similar to what is shown in the following screenshot will be generated:
Spring Initializr also supports the command-line interface to create the Spring project configuration. The following command can be used to generate a project configuration:
> curl https://start.spring.io/starter.zip -d dependencies=web,jpa -d bootVersion=2.0.0 -o ch-09-spring-boot-example-1.zip
As mentioned earlier, Spring Initializr supports integration with IDE. It integrates well with Eclipse/STS, IntelliJ ultimate edition, and NetBeans with NB the SpringBoot plugin.

Starters with Maven

In the preceding section, we looked at the Spring Initializr tool. It is time to quickly look at the starters or dependencies supported by Spring Boot.
Dependency management becomes challenging as the project grows in complexity. It is recommended not to manage the dependencies manually for a complex project...

Indice dei contenuti