Enterprise Java Performance

Enterprise Java Performance

by Steven L. Halter, Steven J. Munroe

Paperback

$42.08 $49.99 Save 16% Current price is $42.08, Original price is $49.99. You Save 16%.

Overview

  • Java performance for real business success
  • Practical, large-scale programming
  • Illustrates common Java pitfalls
  • Includes coverage of CORBA and JINI

Technical Editors: Peter van der Linden, best-selling author of Just Java and Stephen R. Pietrowicz, National Center for Supercomputing Applications, University of Illinois, Urbana-Champaign

"This is the sort of book that I look for as an advanced programmer. There just aren't enough of these types of books out there."
—Stephen R. Pietrowicz, National Center for Supercomputing Applications, University of Illinois, Urbana-Champaign

When your enterprise solutions are written in Java, system performance equals organizational productivity.

As Java is exploding into business environments, programmers require a new approach to encompass enterprise-wide thinking. With today's distributed computing environments magnifying even minor performance pitfalls, large-scale tuning can make the difference between success and just getting by. Steven L. Halter and Steven J. Munroe, who have been working with Java from its very beginning, bring their experiences from the IBM SanFrancisco Project to this unique book.

Their expertise provides a brilliant guide to the complexity of running business code on a massive system with a large, heterogeneous user population. By exploring performance issues from the ground up, they show you how to design a framework to withstand the changing demands of a growing business. Right from the start, you'll get general concepts and specific tips on improving enterprise Java performance, illustrated withactual Java code that you can put to work for you. Just some of the technologies included are: JVM/JIT, SanFrancisco, Enterprise JavaBeans, CORBA, and Jini. Real Java code examples illustrate:

  • Performance theory
  • Performance obstacles
  • Local/remote issues
  • Granularity
  • Benchmarking
  • System tuning
  • Effects of scale
  • SanFrancisco
  • Enterprise JavaBeans
  • CORBA

Product Details

ISBN-13: 9780130172969
Publisher: Pearson Education
Publication date: 08/17/2000
Series: Sun Microsystems Press Java Series
Pages: 432
Product dimensions: 6.98(w) x 9.20(h) x 1.10(d)

About the Author


Steven L. Halter and Steven J. Munroe served as leaders on IBM's SanFrancisco Project, the world's largest and most comprehensive study of Java and performance in business development. Steven L. Halter is an expert in object persistence and object infrastructures. His most recent work centers on ]in i connection technology and the Jiro platform development. Steven J. Munroe's background is in system architecture and design. He was the principal developer of an important Java benchmark, which was submitted by IBM to SPEC. This benchmark was accepted as the SPECjbb2000. You will find it at www.spec.org.

Read an Excerpt

PREFACE:

Preface

The area of using Sun's Java technology for business needs is rapidly expanding. And with that expansion, of course, comes the need to address performance issues in this relatively new environment. Java itself has many performance pitfalls so that when you add the complexity of trying to run business code and scaling systems to meet the demands of many users, guidance is clearly needed. In fact, even very experienced Java programmers can make performance design mistakes in the enterprise environment. The purpose of this book is to describe methods of improving the performance of Enterprise applications developed in the Java programming language. The book will follow a pattern of working from basic examples and then building upon those examples to present the more complex topics within enterprise performance.

The authors have been part of the IBM SanFrancisco Project development team (SanFrancisco provides a common object-oriented infrastructure and application logic for Java application developers). We have watched the Java platform and SanFrancisco mature. As members of the SanFrancisco performance team, we have worked with both JVM/JIT technology suppliers and domain experts developing business object frameworks. This vantage point has given us some deep insights into the do's and don'ts of using Sun's Java technology for enterprise applications. It is this experience that we want to share with IT professionals.

About This Book

This book is aimed at programmers who want to make this technology work most efficiently in the enterprise environment. We assume that readers already have a basic knowledge of the programming language,its syntax, and general class libraries.

Organization

Part 1 lays the foundation for the rest of the book with a general introduction to enterprise performance and Java enterprise performance in particular. Chapter 1, "Performance in General," provides an introduction to performance in general. In Chapter 2, "Tools for Identifying Java Performance," we discuss some common tools for identifying the causes of performance problems, and Chapter 3, "Java Performance Problem Areas," gives some background on common performance problems specific to Java programming. Many of the strengths of Java, such as objects, garbage collection, and similarity to C/C++, can also be pitfalls if not used correctly. By the time you have finished the first three chapters, you will have the ideas and concepts in place that provide a foundation for well-performing Java and for understanding the more in-depth coverage within the remainder of the book.

Part 2 goes into detail on specific areas of Java performance physics. Chapter 4, "Local/Remote Issues," delves into issues of Local vs. Remote objects. Java provides powerful mechanisms (such as RMI) that aid in making the programming model for local objects the same as for remote objects. However, there can be a cost to this transparency, and it is essential to put the objects in the right place. Chapter 5, "Granularity," may also be thought of as expanding on the concept of "put the objects in the right place," but this time it is approached in terms of the granularity of objects, that is, how to decide which objects should be bound together tightly versus being loosely associated. In Chapter 6, "Bottlenecks," we introduce the topic of bottlenecks and how to deal with them. Eliminating bottlenecks is key to well-performing applications. One bottleneck can undo all the best efforts of programming farther down the stream. There are many opportunities for introducing bottlenecks into code.

Part 3 presents information on benchmarking. In Chapter 7, "Java Benchmarking Overview," we overview Java benchmarking tools and look at the plumbing behind it all, including the Java Virtual Machine (JVM), the kind of persistence infrastructure being used, and the distributed object infrastructure. An appropriate benchmark can go a long way toward revealing just how much can be expected from your enterprise application. Chapter 8, "An Application-Level Benchmark," expands on the benchmarking ideas of Chapter 7 and applies them to the application layer.

Part 4 covers four application environments currently used in or with enterprise Java programming. Chapters 9, 10, 11, and 12 detail the SanFrancisco, Enterprise Java Beans, CORBA/Java, and Jini environments, respectively, and how there are various choices in each that can affect the performance of an application running in the environment it defines.

In Part 5, we introduce a way of conceptualizing application models for the Java platform. Chapter 13, "How Java Is Used," reviews different ways in which Java is used, and how Java adapts to these environments: Web Out, Web In, Application Glue, Database Up, Application Wrapper, and Objects Down. Chapter 14, "Performance Implications," explores the performance implications of the various environments presented in Chapter 13.

Part 6 concludes the book with a look at problems and solutions involved in scaling up Java applications. Chapter 15, "System Tuning," examines the effects of the memory, disk, and network configuration on your Java application, and gives tips for system tuning. Chapter 16, "Large-Scale Effects," looks at SMP and cluster effects as well as what happens to Java environments as applications scale up. As the complexity of an application expands, it places greater and greater demands upon the Java infrastructure, such as the Java heap and garbage collection. We also look at how the correct placement, access, and replication of objects within a shared large-scale environment can be critical.

Companion FTP Site

Complete code for the examples presented in this book can be downloaded from the following FTP site:

ftp://ftp.prenhall.com/pub/ptr/sunsoft_books.w-053/enterprise_java_performance

Steven L. Halter is a Senior Staff Software Engineer for Imation Corp, working in the Software Research and Development Rochester Laboratory. He was a Staff Software Engineer for the IBM Software Systems Division and a member of the SanFrancisco Performance group during much of the writing of this book. He has worked in the areas of object persistence and object infrastructures, in which he holds five issued U.S. patents. He has also worked in the architecture and design area for system software for the IBM AS/400. He received his BS and MS degrees in Computer Science from Iowa State University.

Steven Jay Munroe is currently a Senior Software Engineer with IBM and was a member of the SanFrancisco Performance team during the writing of this book. Steve is currently a member of the SanFrancisco Application Deployment team, working with independent software developers and customers deploying SanFrancisco applications. Before joining the SanFrancisco team, Steve worked in various architecture and design roles in system software development for IBM's System/38 and AS/400 products. Steve is an inventor with twelve issued patents. He received a BS degree in Computer Science from Washington State University, Pullman, Washington.

Table of Contents

Foreword xvii
Preface xix
Acknowledgments xxiii
Intellectual Property xxv
About the Authors xxvii
PART 1 Introduction 2(78)
Performance in General
4(22)
Performance Versus Optimization
6(1)
Performance Life Cycle
7(7)
Before Coding
7(2)
During Coding
9(5)
After Coding
14(1)
Types of Performance Problems
14(1)
Low-Hanging Fruit
15(1)
Application Design
16(2)
Poor Design Choices
16(1)
Information Hiding
17(1)
Physics
18(8)
The Java Language and Its Environment
19(1)
Interactions with Other Environments
20(2)
Persisting Java Objects
22(2)
Time, Distance, and Space
24(2)
Tools for Identifying Java Performance
26(18)
Java-Specific Tools
28(6)
Java Profiler
28(1)
Third-Party Java Profiling Tools
29(2)
Simple Timing Measurements
31(1)
Verbosegc
32(2)
The PerfMonitor Class
34(7)
System Tools: Windows NT Performance Monitor
41(2)
Summary
43(1)
Java Performance Problem Areas
44(36)
Basic Timing Comparisons
45(4)
Just In Time and Static Compilation
49(1)
Creating and Reusing Objects
50(5)
Using Constants
55(1)
Using Strings
56(6)
String Tokenizer Usage
61(1)
Exception Usage
62(1)
Loop Techniques
63(3)
Loop Constants
63(1)
Local Variables
64(1)
Terminate Loops Early
65(1)
Casting Techniques
66(3)
Avoid Losing Class Information
66(1)
Avoid Contiguous Instanceof and Casts
67(1)
Avoid Unnecessary Casts and Instanceofs
68(1)
Synchronization
69(1)
Garbage Collection
69(3)
Collections
72(7)
Collections Framework
72(3)
Vectors
75(1)
Hash Tables
76(3)
Summary
79(1)
PART 2 Performance Physics 80(86)
Local/Remote Issues
82(30)
Possible Approaches to Remote Objects
83(6)
Remote Method Invocation
84(2)
Enterprise Java Beans
86(1)
SanFrancisco's Foundation Layer
87(2)
The Costs of Remote Access
89(20)
How to Write and Use a Remote Server in Java
89(6)
Changing Method Call Granularity
95(3)
The Remote Access Spectrum
98(1)
Object Granularity
99(3)
Implications of Granularity for Performance
102(2)
Putting the Data in the Right Place
104(1)
Object Affinity
104(1)
Partitioning
105(4)
Summary
109(3)
Granularity
112(22)
Interface Granularity
114(1)
Implementation Granularity
115(1)
Granularity and Performance: A Design Example
116(16)
Example 1: A Fine-Grained Design
117(8)
Example 2: Make the Orderline Objects Serializable
125(7)
Summary
132(2)
Bottlenecks
134(32)
Why Bottlenecks Are Hard to Avoid
135(1)
Synchronization Bottlenecks
136(7)
Locking Bottlenecks
143(11)
Objects and Locking
145(5)
Deadlocks and Lock Ordering
150(4)
Garbage Collection Bottlenecks
154(10)
Distributed Garbage Collection
164(1)
Summary
165(1)
PART 3 Benchmarking 166(60)
Java Benchmarking Overview
168(32)
Java Benchmarks
170(12)
Pendragon Software CaffeineMark 3.0
171(3)
JMark 2.0
174(2)
VolanoMark 2.1
176(3)
SPECjvm98
179(3)
Our Simple Benchmark
182(16)
Summary
198(2)
An Application-Level Benchmark
200(26)
The BOB Benchmark
202(6)
TPC-C Overview
203(3)
BOB Structure
206(2)
Running BOB
208(5)
BOB Implementation
213(10)
Benchmark Infrastructure
213(6)
Benchmark Transactions
219(4)
Benchmark Entities
223(2)
Summary
225(1)
PART 4 Application Environments 226(76)
SanFrancisco and Performance
228(38)
SanFrancisco Overview
229(2)
Foundation Layer
231(22)
Foundation Object Model Base Classes
232(4)
Business Object Lifecycle
236(2)
Entity Lifecycle
238(3)
Collections and Queries
241(4)
Other Base Classes
245(1)
Foundation Object Model Services
245(8)
Common Business Objects Layer
253(6)
Core Business Processes Layer
259(4)
Useful References
263(1)
Books About SanFrancisco
263(1)
Additional Publications About SanFrancisco
263(1)
IBM Redbooks About SanFrancisco
263(1)
Summary
264(2)
Enterprise Java Beans and Performance
266(16)
J2EE Architecture and Technologies
267(3)
Enterprise Java Beans
270(1)
Choosing an Implementation
270(1)
EJB Implementations and Performance
271(1)
EJB Architecture and Performance
271(8)
Session Beans
272(4)
Entity Beans
276(1)
Flavors of Entity Beans
277(1)
Granularity of EJBs
278(1)
Session Beans Versus Entity Beans
279(1)
Features to Look for in an EJS
279(2)
Summary
281(1)
CORBA and Java
282(12)
CORBA Overview
284(1)
Java IDL
285(1)
RMI-IIOP
286(6)
Effect of RMI over IIOP on Performance
292(1)
Summary
293(1)
Jini and Performance
294(8)
Jini Overview
296(4)
Lookup
296(1)
Discovery
297(1)
Leasing
298(1)
Remote Events
298(1)
Transactions
299(1)
Performance Considerations in Jini
300(1)
Summary
301(1)
PART 5 Application Models 302(64)
How Java Is Used
304(12)
Web Out
306(1)
Web In
307(1)
Application Glue
308(1)
Database Up
309(2)
Application Wrapper
311(1)
Objects Down
312(2)
Combination Approaches
314(1)
Summary
315(1)
Performance Implications
316(50)
Web Out
318(1)
Web In
319(3)
Application Glue
322(5)
Character Encoding and Endian
323(3)
Accumulation of Remote Objects
326(1)
Application Wrapper
327(4)
Excessive Client Interaction
328(1)
Capacity Limits
329(1)
Reducing Client-Server Interactions
330(1)
Database Up
331(2)
Excessive Middleware Interactions
331(2)
Objects Down
333(31)
Excessive Client Interaction
334(1)
Excessive Remote Object Interaction
335(3)
Excessive Middleware Interaction
338(18)
Memory Leaks and Object Retention
356(5)
Excessive Garbage Collection
361(3)
Summary
364(2)
PART 6 Scaling Up 366(29)
System Tuning
368(12)
Memory and System Tuning
369(6)
SanFrancisco Solutions
370(1)
EJB Solutions
371(1)
Database Tuning
371(1)
Operating System Memory Allocation
372(2)
Balancing Memory Requirements
374(1)
Disk Configuration
375(2)
Network Configuration
377(1)
The Performance-Tuning Process
377(2)
Summary
379(1)
Large-Scale Effects
380(15)
The Application and Its Environment
382(5)
Memory
383(1)
Processor
384(2)
Input/Output
386(1)
Software
387(1)
Large-Scale Effects
387(1)
SMP and Cluster Effects
388(5)
Heap Allocation and Garbage Collection on SMP
388(3)
Why Multiple Servers?
391(2)
Object Placement, Access, and Replication
393(1)
Summary
393(2)
APPENDIX A Machines Used 395(2)
A.1 Machine A
395(1)
A.2 Machine B
396(1)
A.3 Machine C
396(1)
Index 397

Preface

PREFACE:

Preface

The area of using Sun's Java technology for business needs is rapidly expanding. And with that expansion, of course, comes the need to address performance issues in this relatively new environment. Java itself has many performance pitfalls so that when you add the complexity of trying to run business code and scaling systems to meet the demands of many users, guidance is clearly needed. In fact, even very experienced Java programmers can make performance design mistakes in the enterprise environment. The purpose of this book is to describe methods of improving the performance of Enterprise applications developed in the Java programming language. The book will follow a pattern of working from basic examples and then building upon those examples to present the more complex topics within enterprise performance.

The authors have been part of the IBM SanFrancisco Project development team (SanFrancisco provides a common object-oriented infrastructure and application logic for Java application developers). We have watched the Java platform and SanFrancisco mature. As members of the SanFrancisco performance team, we have worked with both JVM/JIT technology suppliers and domain experts developing business object frameworks. This vantage point has given us some deep insights into the do's and don'ts of using Sun's Java technology for enterprise applications. It is this experience that we want to share with IT professionals.

About This Book

This book is aimed at programmers who want to make this technology work most efficiently in the enterprise environment. We assume that readers already have a basic knowledge of the programminglanguage,its syntax, and general class libraries.

Organization

Part 1 lays the foundation for the rest of the book with a general introduction to enterprise performance and Java enterprise performance in particular. Chapter 1, "Performance in General," provides an introduction to performance in general. In Chapter 2, "Tools for Identifying Java Performance," we discuss some common tools for identifying the causes of performance problems, and Chapter 3, "Java Performance Problem Areas," gives some background on common performance problems specific to Java programming. Many of the strengths of Java, such as objects, garbage collection, and similarity to C/C++, can also be pitfalls if not used correctly. By the time you have finished the first three chapters, you will have the ideas and concepts in place that provide a foundation for well-performing Java and for understanding the more in-depth coverage within the remainder of the book.

Part 2 goes into detail on specific areas of Java performance physics. Chapter 4, "Local/Remote Issues," delves into issues of Local vs. Remote objects. Java provides powerful mechanisms (such as RMI) that aid in making the programming model for local objects the same as for remote objects. However, there can be a cost to this transparency, and it is essential to put the objects in the right place. Chapter 5, "Granularity," may also be thought of as expanding on the concept of "put the objects in the right place," but this time it is approached in terms of the granularity of objects, that is, how to decide which objects should be bound together tightly versus being loosely associated. In Chapter 6, "Bottlenecks," we introduce the topic of bottlenecks and how to deal with them. Eliminating bottlenecks is key to well-performing applications. One bottleneck can undo all the best efforts of programming farther down the stream. There are many opportunities for introducing bottlenecks into code.

Part 3 presents information on benchmarking. In Chapter 7, "Java Benchmarking Overview," we overview Java benchmarking tools and look at the plumbing behind it all, including the Java Virtual Machine (JVM), the kind of persistence infrastructure being used, and the distributed object infrastructure. An appropriate benchmark can go a long way toward revealing just how much can be expected from your enterprise application. Chapter 8, "An Application-Level Benchmark," expands on the benchmarking ideas of Chapter 7 and applies them to the application layer.

Part 4 covers four application environments currently used in or with enterprise Java programming. Chapters 9, 10, 11, and 12 detail the SanFrancisco, Enterprise Java Beans, CORBA/Java, and Jini environments, respectively, and how there are various choices in each that can affect the performance of an application running in the environment it defines.

In Part 5, we introduce a way of conceptualizing application models for the Java platform. Chapter 13, "How Java Is Used," reviews different ways in which Java is used, and how Java adapts to these environments: Web Out, Web In, Application Glue, Database Up, Application Wrapper, and Objects Down. Chapter 14, "Performance Implications," explores the performance implications of the various environments presented in Chapter 13.

Part 6 concludes the book with a look at problems and solutions involved in scaling up Java applications. Chapter 15, "System Tuning," examines the effects of the memory, disk, and network configuration on your Java application, and gives tips for system tuning. Chapter 16, "Large-Scale Effects," looks at SMP and cluster effects as well as what happens to Java environments as applications scale up. As the complexity of an application expands, it places greater and greater demands upon the Java infrastructure, such as the Java heap and garbage collection. We also look at how the correct placement, access, and replication of objects within a shared large-scale environment can be critical.

Companion FTP Site

Complete code for the examples presented in this book can be downloaded from the following FTP site:

ftp://ftp.prenhall.com/pub/ptr/sunsoft_books.w-053/enterprise_java_performance

Steven L. Halter is a Senior Staff Software Engineer for Imation Corp, working in the Software Research and Development Rochester Laboratory. He was a Staff Software Engineer for the IBM Software Systems Division and a member of the SanFrancisco Performance group during much of the writing of this book. He has worked in the areas of object persistence and object infrastructures, in which he holds five issued U.S. patents. He has also worked in the architecture and design area for system software for the IBM AS/400. He received his BS and MS degrees in Computer Science from Iowa State University.

Steven Jay Munroe is currently a Senior Software Engineer with IBM and was a member of the SanFrancisco Performance team during the writing of this book. Steve is currently a member of the SanFrancisco Application Deployment team, working with independent software developers and customers deploying SanFrancisco applications. Before joining the SanFrancisco team, Steve worked in various architecture and design roles in system software development for IBM's System/38 and AS/400 products. Steve is an inventor with twelve issued patents. He received a BS degree in Computer Science from Washington State University, Pullman, Washington.

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews

Enterprise Java Performance 5 out of 5 based on 0 ratings. 1 reviews.
Guest More than 1 year ago
Steve and I met ten years ago while building a prototype persistent object system. By the time we joined the SanFrancisco project (SanFrancisco provides a common object-oriented infrastructure and application logic for Java application developers) in early 1996 we had a lot of experience with building plumbing (object oriented Infrastructures), and it was time to see object technology work for a living (to implement core business processes). It was about this time that the SanFrancisco team made the fateful decision to switch from C++ to Java. We have watched Java and SanFrancisco mature together. As members of the SanFrancisco performance team, we worked with JVM/JIT technology suppliers, infrastructure developers, domain experts developing business object frameworks, and Independent Software Vendors deploying complete business applications. This vantage point has given us some deep insights into the do's and don'ts of using Java for enterprise applications. This experience extends to the emerging Enterprise Java Beans and CORBA standards. It is this experience that we want to share in this book. This book is our best effort to write about 'what we know'. We hope that you will find it a useful addition to your library.