第一句子网 - 唯美句子、句子迷、好句子大全
第一句子网 > java platform performance_Java Performance

java platform performance_Java Performance

时间:2023-02-23 20:36:33

相关推荐

java platform performance_Java Performance

【实例简介】

java性能监控,想深入jvm的同学可以下载哦,良心推荐。还推荐system perfrmance不错的教程

OREILLY

Java performance The Definitive guide

Coding and testing are often considered separate areas of expertise. In this

book, author and Java expert Scott Oaks takes the approach that anyone

who works with Java should be equally adept at understanding how code

behaves in the JVM, as well as the tunings likely to help its performance

Gain in-depth knowledge of Java application performance, using the

Java Virtual Machine (vm) and the Java platform, including the language

and APl. With this comprehensive guide, developers and performance

engineers alike will learn a variety of features, tools, and processes for

mproving the way Java 7 and 8 applications perform

Apply four principles for obtaining the best results from

performance testing

a Use jdK tools to collect data on how a Java application is

perTorming

a Understand the advantages and disadvantages of using a JIT

compiler

a Tune JVM garbage collectors to affect programs as little as possible

a Use techniques to manage heap memory and JVM native memory

a Maximize Java threading and synchronization performance

features

a Tackle per formance issues in Java EE and Java SE APls

Improve Java-driven database application performance

Scott oaks is an architect at oracle corporation where he works on the perfor

mance of Oracle's middleware software employed by sun microsystems in 1987

he became Suns Java evangelist and in 2001 joined their Java Per formance

group, which is now his primary focus. Scott has written O'reilly books on Java

Security, Java Threads, and Jin

PROGRAMMING/JAVA

口口

Twitter: oreillymedia

facebook. com/oreilly

US$449

CAN$47.99

ISBN:978-1-449-35845-7

54499

9781449135845

Java performances

The definitive guide

Scott oaks

Beijing· Cambridge.mham·Kh· Sebastopol. TokyoOREILLY

Java performance: the definitive guide

by scott oaks

Copyright C Scott Oaks. All rights reserved

Printed in the United States of america

Published by o reilly media, InC., 1005 Gravenstein Highway North, Sebastopol, CA 95472

OReilly books may be purchased for educational,business, or sales promotional use. Online editions are

alsoavailableformosttitles().fOrmoreinformation,contactourcorporate

institutionalsalesdepartment800-998-9938orcorporate@

Editor: Meghan blanchette

Indexer: Judith McConville

Production Editor: Kristen Brown

Cover Designer: Karen Montgomery

Copyeditor: Becca Freed

Interior Designer: David Futato

Proofreader: Charles roumeliotis

strator: Rebecca demarest

April

First edition

Revision History for the First Edition:

-04-09 First release

See/catalog/errata.csp?isbn=9781449358457forreleasedetails

Nutshell Handbook, the Nutshell Handbook logo, and the O Reilly logo are registered trademarks ofO Reilly

Media, Inc. Java Performance: The Definitive Guide, the image of saiga antelopes, and related trade dress are

trademarks of O Reilly Media, Inc

Many of the designations used by manufacturers and sellers to distinguish their products are claimed as

trademarks. Where those designations appear in this book, and O Reilly Media, Inc was aware ofa trademark

claim, the designations have been printed in caps or initial caps

While every precaution has been taken in the preparation of this book, the publisher and author assume no

responsibility for errors or omissions, or for damages resulting from the use of the information contained

herein

ISBN:978-1-449-35845-7

Table of contents

Preface

1. Introduction

A Brief outline

Platforms and Conventions

JVM Tuning Flags

The Complete Performance Story

Write Better Algorithms

Write Less code

Oh Go Ahead, Prematurely optimize

22455678

Look Elsewhere: The Database Is always the bottleneck

Optimize for the Common Case

ummary

10

2. An Approach to Performance Testing

11

Test a Real application

11

Microbenchmarks

Macrobenchmarks

16

Mesobenchmarks

18

Common Code examples

20

Understand Throughput, Batching, and Response Time

24

Elapsed Time(Batch) Measurements

24

Throughput Measurements

25

Response Time Tests

26

Understand variability

29

Test early, Test Often

33

Summary

36

3. A Java performance toolbox

,37

Operating system Tools and analysis

37

CPU USage

38

The CPU Run Queue

41

Disk usage

43

Network Usage

Java Monitoring Tools

46

Basic vm information

Thread information

50

Class Information

51

Live gC analysis

51

Heap Dump Postprocessing

51

Profiling Tools

51

Sampling Profilers

52

Instrumented profilers

54

Blocking Methods and Thread Timelines

55

Native Profilers

ava mission control

Java Flight Recorder

60

Enabling

JFR

Selecting FR Events

Summary

72

4. Working with the JIT Compiler..............

Just-in-Time Compilers: An Overview

73

Hot Spot Compilation

75

Basic Tunings: Client or Server (or Both)

Optimizing Startup

Optimizing batch Operations

80

Optimizing Long-Running Applications

81

Java and JIT Compiler versions

82

Intermediate Tunings for the Compiler

85

Tuning the Code Cache

85

Compilation Thresholds

87

Inspectin

g

the Compilation Process

90

Advanced Compiler Tunings

94

Compilation Threads

94

Inlining

96

E

A

nalySiS

97

Deoptimization

8

Not entrant code

98

Deoptimizing Zombie Code

101

Tiered Compilation Levels

101

Table of contents

ummary

103

5. An Introduction to Garbage collection

105

Garbage Collection Overview

105

Generational Garbage Collectors

107

GC Algorithms

109

Choosing a gC algorithm

113

Basic Gc tuning

119

Sizing the Heap

119

Sizing the generations

122

Sizing permgen and metaspace

124

Controlling Parallelism

126

Adaptive Sizing

127

GC Tools

128

Summary

131

6. Garbage collection algorithms....................... 133

Understanding the Throughput Collector

133

Adaptive and static heap size tuning

136

Understanding the CMs Collector

140

Tuning to Solve Concurrent Mode Failures

Tuning CMS for Permgen

148

Incremental CMs

149

Understanding the Gl Collector

150

Tuning GI

157

Advanced tunings

159

Tenuring and Survivor Spaces

159

Allocating Large Objects

163

AggressiveHeap

171

Full Control Over Heap Size

173

Summary

174

7. Heap memory best practices

177

Heap analysis

177

Heap Histograms

178

Heap dumps

179

Out of Memory errors

184

g

188

Reducing Object Size

188

Lazy initialization

191

Immutable and Canonical objects

196

String interning

g

198

Table of content

Object Lifecycle management

202

Object reuse

202

Weak, Soft, and Other References

208

Summary

221

8. Native Memory Best Practices

223

Footprint

223

Measuring Footprint

224

Minimizing footprint

225

Native NIO Buffers

226

Native Memory Tracking

227

JVM Tunings for the Operating System

230

Large pages

230

C

compressed oops

234

Summary

236

9. Threading and Synchronization Performance................. 237

Thread pools and Thread Poolexecutors

237

Setting the maximum Number of Threads

238

Setting the Minimum Number of Threads

242

Thread Pool Task sizes

243

Sizing a ThreadPoolExecutor

244

The ForkJoin Pool

246

Automatic Parallelization

252

Thread Synchronization

254

Costs of Synchronization

254

Avoiding synchronization

259

False Sharing

262

JVM Thread Tunings

267

Tuning Thread Stack Sizes

267

Biased Locking

268

Lock Spinning

268

Thread Priorities

269

Monitoring Threads and Locks

270

Thread visibility

270

Blocked Thread visibility

271

ummary

275

10. Java Enterprise Edition Performance

,277

Basic Web container performance

277

Http Session State

280

Thread pools

283

ⅵi| Table of contents

Enterprise Java Session Beans

283

Tuning ejB pools

283

Tuning EJB Caches

286

Local and remote instances

288

XML and jSoN Processing

289

Data size

290

An Overview of Parsing and Marshalling

291

Choosing a Parser

293

XML Validation

299

Document models

302

Java Object Models

305

Object Serialization

307

Transient fields

307

O

iding default serializati

307

Compressing serialized data

311

K

eeping

Track of duplicate objects

31

Java EE Networking APis

316

Sizing Data Transfers

316

Summary

318

11. Database performance best practices

,321

JDBC

322

JDBC Drivers

322

Prepared Statements and Statement Pooling

324

JDBC Connection Pools

326

Transactions

327

Result set processing

335

JPA

337

Transaction Handling

337

Optimizing jPa Writes

340

Optimizing JPA Reads

342

JPA Caching

346

JPA Read-Only Entities

352

Summary

353

12. Java se api tips

,355

Buffered i/o

355

Classloading

358

Random numbers

362

ava Native interface

364

Exceptions

366

String performance

370

Table of Contents

【实例截图】

【核心代码】

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。