Home > Store

Java Performance and Scalability, Volume 1: Server-Side Programming Techniques

Register your product to gain access to bonus material or receive a coupon.

Java Performance and Scalability, Volume 1: Server-Side Programming Techniques

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2000
  • Edition: 1st
  • Book
  • ISBN-10: 0-201-70429-3
  • ISBN-13: 978-0-201-70429-7

This book was written with one goal in mind: to provide Java programmers with the expertise needed to build efficient, scalable Java code. The author shares his experience in server-side performance tuning through measured performance assessments, called optimizations. Each optimization discusses techniques to improve the performance and scalability of your code. Every claim is substantiated with hard numbers and an experience-based evaluation. Java™ Performance and Scalability, Volume 1, provides invaluable advice that you will, no doubt, find useful in your coding.

Presented in 48 concise lessons that target the most common and critical performance pitfalls, this book offers a plethora of practical tips and solutions for boosting the performance of your programs. These lessons cover performance-critical areas such as memory management, garbage collection, caching, and multithreading.

Specific lessons include:

  • Reserving StringBuffer capacity
  • Avoiding premature object creation
  • Creating an efficient vector class
  • Designing caching into your API
  • The cost of synchronization
  • Parallel subtasks
  • JNI efficiency
  • Varying the server workload and RMI network plumbing
  • Using ServletOutputStream
  • Caching JDBC™ connections

In addition to providing hard numbers that quantify the optimizations, the author concludes the book with an application demonstrating the effectiveness of the performance optimizations. The exercise takes a typical program and increases its performance fourfold through a series of steps that tie together the lessons learned throughout the book. He offers both the means and the proof to better coding.



0201704293B04062001

Downloads

Source Code

Click below for Source Code related to this title:
code.zip

Sample Content

Table of Contents



List of Figures.


Preface.


Introduction.

1 Java Strings.

Optimization 1: String Concatenation.
Optimization 2: Fight Object Overpopulation.
Optimization 3: String Equality.
Optimization 4: Characters to Bytes and Back.
Optimization 5: StringTokenizer.
Optimization 6: charAt().
Optimization 7: Prefer charAt() to startsWith().
Optimization 8: Reserve StringBuffer Capacity.
Key Points.

2 Pure Overhead.

Optimization 9: Useless Computations.
Optimization 10: Don't Trace Trivial Methods.
Optimization 11: Making Overhead Vanish.
Optimization 12: Premature Object Creation.
Optimization 13: Don't Initialize Twice.
Optimization 14: Do You Really Need to Zero-Out a Buffer?
Optimization 15: The 80-20 Principle.
Optimization 16: Purge Obsolete Code.
Key Points.

3 Vectors and Hashtables.

Optimization 17: Vector Add and Remove.
Optimization 18: Vector Capacity.
Optimization 19: Vector Enumeration.
Optimization 20: Efficient Vector Class.
Optimization 21: Using the API Wisely.
Optimization 22: Hashtable Parameters.
Optimization 23: Speed Up hashCode().
Optimization 24: Speed Up equals().
Key Points.

4 Caching.

Optimization 25: Cache File Contents.
Optimization 26: Design Caching into Your API.
Optimization 27: Precompute.
Optimization 28: Relax Granularity.
Optimization 29: Inheritance.
Key Points.

5 I/O Streams.

Example I/O Code.
Optimization 30: Output Buffering.
Optimization 31: Don't Flush Prematurely.
Optimization 32: Prefer Byte Stream to Unicode.
Optimization 33: Input Buffering.
Optimization 34: Byte-to-Char Conversions.
Optimization 35: Binary I/O.
Key Points.

6 Recycling.

Optimization 36: Object Recycling.
Optimization 37: Object Pools.
Optimization 38: Last In, First Out.
Key Points.

7 Scalability and Multithreading.

Scalability Basics.
The SMP Architecture.
Amdahl's Law.
Multithreaded and Synchronization Terminology.
The Cost of Synchronization.
Optimization 39: Parallel Subtasks.
Optimization 40: Synchronization False Sharing.
Optimization 41: Lock Fusion.
Optimization 42: Code Motion.
Optimization 43: Share Nothing.
Optimization 44: Partial Sharing.
Optimization 45: Read/Write Locks.
Key Points.

8 JNI.

Optimization 46: JNI Surprise.
Optimization 47: JNI to the Rescue.
Optimization 48: Prefer System.arraycopy().
Key Points.

9 RMI.

The RMI Network Plumbing.
Varying the Server Workload.
RMI Server on Remote Machine.
Serializing Heavyweight Objects.
Key Points.

10 Servlets.

Servlets Using PrintWriter.
Servlets Using ServletOutputStream.
Precomputing Message Bytes.
Pumping More Data.
PingServlet--A Performance Upper Bound.
Extending PingServlet.
Session State.
PingJdbc.
Caching JDBC Connections.
JSP--Java Server Pages.
RMI.
Key Points.

11 A Java Web Server.

Version 1: The Original Server.
Version 2.
Version 3.
Version 4.
Version 5.
Version 6.
Key Point.
A Caching JDBC Connections.

CacheDriver.java.

CacheConnection.java.

CacheStatement.java.

CacheCallableStatement.java.

CachePreparedStatement.java.

CacheDriver.properties.

B Simple Java Web Server.

Server.java.

FileInfo.java.

UrlCache.java.

LazyDate.java.

MyGetBytes.java.

server.properties.

Bibliography.
Index. 0201704293T04062001

Preface

Performance has been one of the dominant concerns hovering around Java from its infancy. Regardless of an order of magnitude speedup resulting from just-in-time (JIT) compilers, HotSpot, and other advances in JVM technology, the performance issue is still a legitimate concern. The reality facing Java programmers is that it is very easy to write slow Java programs. Java is a performance mine field and expert guidance is a must.

Given the importance of performance to Java developers, it is somewhat surprising that no book has been dedicated to this important topic. Almost any other Java-related issue has had multiple books dedicated to it--RMI, JNI, JDBC, threads, networking, and the list goes on. Conspicuously absent has been Java performance. It has been mentioned in passing by many authors but, to my knowledge, rarely has there been more than a chapter discussing it. This book is aiming to fill that gaping hole. It is entirely focused on Java performance issues from start to finish.

This book is written for Java programmers by a Java programmer. This is an important fact. It is very likely that the Java performance issues that I have dealt with in my code will surface in your code as well. The Java optimization techniques that you will find here will significantly elevate the performance and scalability of your Java programs.

There's plenty of material to cover. Let's get started.



0201704293P04062001

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.