万本电子书0元读

万本电子书0元读

顶部广告

Hands-On High Performance with Spring 5电子书

售       价:¥

0人正在读 | 0人评论 9.8

作       者:Chintan Mehta,Subhash Shah,Pritesh Shah

出  版  社:Packt Publishing

出版时间:2018-06-12

字       数:52.6万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
A hands-on guide to creating, monitoring, and tuning a high performance Spring web application About This Book ? 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 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. 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 In Detail 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. Style and approach This book takes a step-by-step approach with focused examples to teach you how to increase application performance.
目录展开

Title Page

Copyright and Credits

Hands-On High Performance with Spring 5

Packt Upsell

Why subscribe?

PacktPub.com

Contributors

About the authors

About the reviewer

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Download the color images

Conventions used

Get in touch

Reviews

Exploring Spring Concepts

Introducing the Spring Framework

Problems with EJB

Simplifying implementation using POJO

Benefits of the Spring Framework

No need to reinvent the wheel

Ease of unit testing

Reduction in implementing code

Inversion of control and API

Consistency in transaction management

Modular architecture

Up to date with time

Understanding Spring modules

Core Container

Crosscutting concerns

Data Access/Integration

Web

Spring projects

Spring Boot

Spring Data

Spring Batch

Spring Cloud

Spring Security

Spring HATEOAS

Spring's IoC container

What are Spring beans?

Instantiating a Spring container

BeanFactory

ApplicationContext

Spring bean life cycle

New features in the Spring Framework 5.0

Baseline upgrades

Reactive programming support

Core features upgrades

Spring Web MVC upgrades

Spring's new functional web framework – WebFlux

Modularity support

Kotlin language support

Improved testing support

Dropped or deprecated features

Summary

Spring Best Practices and Bean Wiring Configurations

Dependency injection configurations

Types of DI patterns

Constructor-based DI

Advantages of the constructor-based DI

Disadvantages of the constructor-based DI

Setter-based DI

Advantages of the setter-based DI

Disadvantages of the setter-based DI

Field-based DI

Constructor versus setter injection

Configuring the DI with Spring

XML-based configuration

Java-based configuration

Annotation-based configuration

The @Autowired annotation

@Autowired with required = false

The @Primary annotation

The @Qualifier annotation

Automatic bean detection with stereotype annotations

The @ComponentScan annotation

The @Lazy annotation

Spring bean scopes

Performance assessment with different configurations

Lazy loading versus preloading

Singleton versus prototype bean

Spring bean configuration best practices

DI pitfalls

First pitfall

Second pitfall (with AOP)

Summary

Tuning Aspect-Oriented Programming

AOP concepts

Limitations of OOP

Code tangling

Code scattering

AOP – problem solver

Spring AOP terminology and concepts

Defining pointcuts

Types of advice

Aspect instantiation models

AOP proxies

JDK dynamic proxies and CGLIB proxies

ProxyFactoryBean

ProxyFactoryBean in action

Performance JDK dynamic proxy versus CGLIB proxy

Caching

AOP method profiling

PerformanceMonitorInterceptor

Custom monitoring interceptor

Spring AOP versus AspectJ

What is AspectJ?

Differences between Spring AOP and AspectJ

Capabilities and goals

Weaving

Join points

Simplicity

Performance

AspectJ with Spring

AOP best programming practices

Pointcut expressions

Advice ordering

Best practices of AOP proxies

Caching

Summary

Spring MVC Optimization

Spring MVC configuration

Spring MVC architecture

XML-based configuration

Configuring front controller

Creating a Spring application context

Configuring ViewResolver

Java-based configuration

Configuring front controller

Creating a Spring application context and configuring a ViewResolver

Creating a controller

Creating a view

Spring asynchronous processing, @Async annotation

@Async annotation modes

Fire and forget mode

Result retrieval mode

Limitations of @Async annotation

Thread pool executor

CompletableFuture with Spring Async

runAsync() – running a task asynchronously

supplyAsync() – running a task asynchronously, with a return value

Attaching a callback to the CompletableFuture

Spring Security configuration

Configuring Spring Security dependencies

Configuring a security filter for incoming requests

Configuring Spring Security

Adding a controller

Authentication cache

Implementing the caching configuration class

Providing UserCache to AuthenticationProvider

Providing AuthenticationProvider to AuthenticationManagerBuilder

Fast and stateless API authentication with Spring Security

API authentication with the JSESSIONID cookie

API authentication without the JSESSIONID cookie

Monitoring and managing Tomcat with JMX

Connecting JMX to monitor Tomcat

Creating an MBean

Exporting an MBean in a Spring context

Spring MVC performance improvements

High performance using connection pooling

Hibernate improvements

Testing improvements

Proper server maintenance

Using the authentication cache with Spring Security

Implementing Executor service framework

Summary

Understanding Spring Database Interactions

Spring JDBC configuration

Problems with core JDBC

Solving problems with Spring JDBC

Spring JDBC dependencies

Spring JDBC example

Database design for optimal performance

Table design

Vertical partitioning of a table

Use indexing

Using the correct data type

Defining column constraints

Using stored procedures

Transaction management

Choosing a transaction manager in Spring

Declarative ACID using @Transactional

Optimal isolation levels

Read uncommitted

Read committed

Repeatable read

Serializable

Optimal fetch size

Optimal connection pooling configuration

Sizing the connection pool

Validate connections

Connection leaks

Tomcat JDBC connection pool versus HikariCP

Reliability

Performance

Features

Ease of use

Database interaction best practices

Using Statement versus PreparedStatement versus CallableStatement

Using Batch instead of PreparedStatement

Minimizing the use of database metadata methods

Using get methods effectively

When to avoid connection pooling

Choose commit mode carefully

Summary

Hibernate Performance Tuning and Caching

Introduction to Spring Hibernate and Spring Data

Spring Hibernate

Spring Data

Spring Hibernate configuration

Spring with JPA using Hibernate

Spring Data configuration

Common Hibernate traps

Hibernate n + 1 problem

The open session in view anti-pattern

Unknown Id.generator exception

Hibernate performance tuning

Approaches to avoid the n + 1 problem

Fetch join using JPQL

Join fetch in Criteria API

Named entity graph

Dynamic entity graph

Finding performance issues with Hibernate statistics

Using query-specific fetching

Caching and its best practices

First level cache

Second level cache

Query cache

Performing updates and deletes in bulk

Hibernate programming practices

Caching

Miscellaneous

Summary

Optimizing Spring Messaging

What is messaging?

What is AMQP?

Problems with the JMS API

Why do we need AMQP?

Differences between AMQP and the JMS API

Platform compatibility

Messaging models

Message data type

Message structure

Message routing

Workflow strategy

What are exchanges, queues, and bindings?

Exchange

Queue

Binding

Introducing RabbitMQ

Setting up the RabbitMQ server

Spring messaging configuration

Configuring a Maven dependency for RabbitMQ

Configuring RabbitMQ

Configuring ConnectionFactory

Configuring a queue

Configuring an exchange

Configuring a binding

Configuring RabbitAdmin

Configuring a message converter

Creating a RabbitTemplate

Configuring a listener container

Creating a message receiver

Creating a message producer

Maximizing throughput with RabbitMQ

Performance and scalability with RabbitMQ

Summary

Multithreading and Concurrent Programming

Java classical threads

Creating threads

Thread life cycle and states

More advanced thread tasks

Synchronizing threads

Issues with multithreading

The java.util.concurrent package

Executors

ThreadFactory

Synchronizers

Concurrent collection classes

Lock

Callable and Future

Atomic variables

Using thread pools for asynchronous processing

Spring task execution and scheduling

TaskExecutor

TaskScheduler

Spring Async

The @EnableAsync annotation

The @Async annotation

@Async with CompletableFuture

Spring and threads – transactions

Java threads best programming practices

Summary

Profiling and Logging

Performance profiling

Application performance

Application logging and monitoring

Application logging

Logging best practices

Logging tools

Java standard logging

Apache Log4j 2

Application monitoring

Stagemonitor

Pinpoint

MoSKito

Glowroot

New Relic

Profiling tools

VisualVM

JConsole

Summary

Application Performance Optimization

Performance issue symptoms

Timeouts

Running out of worker threads

Threads waiting on class loaders

Time spent on class-loading activities

Class loader trying to load non-existent classes

Performance tuning life cycle

Connection pooling

Hibernate

Transaction

Periodical clearing of Hibernate sessions

Lazy initialization

Constructor-based HQLs

Entity and query caching

Native queries

Primary key generation

Database

Indexing

Views

Spring Security

Authentication cache

LDAP custom authorities

Native LDAP

Multithreading

Performance tuning patterns and anti-patterns

Anti-patterns

Architectural anti-patterns

Implementing anti-patterns

The iterative performance-tuning process

Spring support of JMX

Managed beans

Summary

Inside JVM

Understanding JVM internals

Class loader subsystem

Memory areas

Execution engine

Understanding memory leak

Memory leak in Java

Common reasons for memory leaks

Common pitfalls

Number of garbage collectors

Wrong garbage collector

Parallel / Concurrent keywords

G1 is a problem solver

Average transaction time

Reducing new object allocation rates improves GC behavior

GC logs cause overhead

GC

How GC works

GC roots

GC methods and policies

Serial collector

Parallel/Throughput collector

CMS garbage collector

G1 collector

Heap memory

JVM flags

-Xms and -Xmx

-XX:NewSize and -XX:MaxNewSize

-XX:NewRatio

-XX:SurvivorRatio

-XX:InitialTenuringThreshold, -XX:MaxTenuringThreshold, and -XX:TargetSurvivorRatio

-XX:CMSInitiatingOccupancyFraction

-XX:+PrintGCDetails, -XX:+PrintGCDateStamps, and -XX:+PrintTenuringDistribution

Tools to analyze GC logs

GCeasy

Tips on JVM tuning

JVM Heap Size

Key Performance Indicators

GC Statistics

GC Causes

Summary

Spring Boot Microservice Performance Tuning

Spring Boot configuration

What is Spring Boot?

Spring Initializr

Starters with Maven

Creating your first Spring Boot application

Metrics with Spring Boot Actuator

What is Spring Actuator?

Enabling Spring Boot Actuator

Enabling endpoints

Health checks

Microservices using Spring Boot

First microservice with Spring Boot

Loading sample data into the database

The JPA way of initial data loading

The ApplicationRunner way of initial data loading

Microservice client

Microservices with Spring Cloud

Spring microservice configuration example

Monitoring microservices with Spring Boot admin

Spring Boot performance tuning

Undertow as an embedded server

Overhead with the @SpringBootApplication annotation

Summary

Other Books You May Enjoy

Leave a review - let other readers know what you think

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部