Performance considerations for application design

 < Day Day Up > 



This section suggests application design considerations that can be derived from the analysis of the test results.

Remote interface designs

Now that we understand the costs of object serialization in J2EE applications, we can look at the design of the remote interface. Remote methods must use minimal parameters to reduce the deserialization and serialization costs. Remote methods must use complex data types with caution, as they are more expensive to serialize.

In J2EE parlance, value objects are aggregations of logically cohesive attributes. The use of value objects in the remote interface can reduce the number of remote method invocations on a component and hence improve performance. The cost of serialization and deserialization is not necessarily mitigated with the use of value objects. Value objects can easily be misused if clients needing just a single element of the value object use the method returning the entire object or collection of objects. In such cases the serialization and deserialization costs are incurred needlessly.

With EJB 2.0, developers can choose to locate a component locally or remotely. Local EJBs reduce serialization costs and, therefore, it is beneficial to use them when the interface contains large objects. One trend is to use entity EJBs as local interfaces, and remote session EJBs to wrapper them. In previous versions of WebSphere Application Server, using "pass objects by reference" command line arguments to the JVM mimicked local EJB behavior.

HTTP session objects

Session objects that are persisted are serialized and written to the database. Larger session objects and more complicated object graphs result in higher costs. Keeping session objects small and simple helps the overall application performance.

Reducing serialization costs

Keeping object graphs simple and as small as possible minimizes serialization costs in a distributed application. As seen in Figure 6-9 with the optimized person object (PersonOpt), serialization can be more efficient when the implementation is known and direct access to private variables is available. However, implementations of serialization can be tricky and difficult to maintain. Since larger objects can benefit more from serialization optimization (as seen in Figures 6,7, and 8), it should be considered for large objects that are serialized frequently, so that the performance improvements are significant enough to justify the effort. Another trick is to use transient objects if they can easily be reconstructed on the remote end of method invocations. This reduces serialization costs since any fields qualified as transient are not serialized.

Understanding workloads

It is important to understand the workloads of a server in order to use serialization cost reduction techniques. From Figure 6-9, it is clear that heavily used transactions benefit from serialization optimizations. The optimizations can be nontrivial and have an associated maintenance and programming cost. It is therefore very important to make an effort based on objective understanding of the workload.



 < Day Day Up > 



High-Volume Web Sites Team - More about High-Volume Web Sites
High-Volume Web Sites Team - More about High-Volume Web Sites
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 117

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net