11.8 Miscellaneous Best Practices

I l @ ve RuBoard

Finally, here is a set of miscellaneous best practices that have not been mentioned anywhere else in the book. Keep these in mind when creating the various parts of your enterprise system.

11.8.1 Design

  • Design objects so that they can be easily replaced by a faster implementation.

  • Use interfaces and interface-like patterns (e.g., the Factory pattern).

  • Design for reusable objects.

  • Use stateless objects.

  • Consider whether to optimize objects for update or for access.

  • Minimize data conversions.

11.8.2 Monitoring

  • Constantly monitor the running application.

  • Retain performance logs. Choose one set as your comparison standard.

  • Monitor as many parameters as possible throughout the system.

  • Note every single change to the system.

  • Listen to the application users, but double-check any reported problems.

  • Ensure that caching effects do not skew the measurements of a reported problem.

  • Train users to use the application efficiently .

11.8.3 Parallelism

  • Design parallelism into the application wherever possible. Identify what cannot be parallelized. Watch out for too much parallelism. There are diminishing returns from parallelism overheads.

  • Balance workloads. Unbalanced parallel activities can limit the performance of the system.

  • Split up the data among many different files (preferably on separate disks).

  • Support asynchronous communications.

  • Decouple activities so that no activity is unnecessarily blocked by another activity.

  • Minimize points where parallel activities are forced to converge.

11.8.4 Distributed Computing

  • Minimize the communication between distributed components .

  • Avoid generating distributed garbage.

  • Reduce transfer costs by duplicating data.

  • Cache distributed data wherever possible.

  • Minimize the synchronization requirements of duplicated data.

  • Use compression to reduce transfer time.

11.8.5 JMS

  • Close resources (e.g., connections, session objects, producers , and consumers) when you're finished with them.

  • Start the consumer before the producer so that the initial messages do not need to queue as they wait for the consumer.

  • Use separate transactional sessions and nontransactional sessions.

  • Use nonpersistent messages, as they are faster than persistent messages.

  • Use shorter messages, as longer messages take longer to deliver and process.

  • Specify the lowest redelivery count and time-to-live that the application can accept.

  • Maximize message throughput by tuning the delivery capacity.

  • Use asynchronous reception of messages with the MessageListener interface.

  • Process messages simultaneously with ConnectionConsumers and ServerSessionPools .

  • Throttle very high-volume message delivery to a rate the consumers can handle. Use load-balanced message queues if necessary.

  • Duplicate-delivery mode is the fastest possible delivery mode, followed by auto-acknowledgment mode. Try to avoid client acknowledgment mode.

  • Use publish-and-subscribe for large numbers of active listeners, and point-to-point connections for few active listeners.

I l @ ve RuBoard


The OReilly Java Authors - JavaT Enterprise Best Practices
The OReilly Java Authors - JavaT Enterprise Best Practices
ISBN: N/A
EAN: N/A
Year: 2002
Pages: 96

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