Practical guidelines for boosting Java server performance

As Java technology matures, an increasing number of applications that have traditionally been the domain of languages such as C++ are implemented in Java. Many of these applications such as Internet servers demand high execution speed. Currently, it is mostly the programmer’s responsibility to optimize Java code for speed. This paper presents several simple yet effective source code-level guidelines for accelerating Java programs. Among the performance enhancing rules described in the paper are object reuse, avoiding Java API methods with implicit object allocations, statically creating immutable objects, thread pooling, and avoiding dynamically expanding objects. All these rules aim at reducing the frequency of object allocations and objectto-object copy operations. Using examples, the paper demonstrates up to 15-fold accelerations by using these guidelines. When applied under the appropriate circumstances explained in the paper, none of the rules leads to performance penalties.