Performance Design Principles
From Guidance Share
Jump to navigationJump to search
- J.D. Meier, Srinath Vasireddy, Ashish Babbar, Rico Mariani, and Alex Mackman
Design
- Design coarse-grained services.
- Minimize round trips by batching work.
- Acquire late and release early.
- Evaluate affinity with processing resources.
- Put the processing closer to the resources it needs.
- Pool shared resources.
- Avoid unnecessary work.
- Reduce contention.
- Use progressive processing.
- Process independent tasks concurrently.
Deployment
- Consider your deployment architecture.
- Identify constraints and assumptions early.
- Evaluate server affinity.
- Use a layered design.
- Stay in the same process.
- Do not remote application logic unless you need to.
- Consider whether you need to support scale out.
- Consider design implications and tradeoffs up front.
- Consider database partitioning at design time.
Caching
- Decide where to cache data.
- Decide what data to cache.
- Decide the expiration policy and scavenging mechanism.
- Decide how to load the cache data.
- Avoid distributed coherent caches.
Coupling and Cohesion
- Design for loose coupling.
- Design for high cohesion.
- Partition application functionality into logical layers.
- Use early binding where possible.
- Evaluate resource affinity.
Communication
- Choose the appropriate remote communication2 mechanism.
- Design chunky interfaces.
- Consider how to pass data between layers.
- Minimize the amount of data sent across the wire.
- Batch work to reduce calls over the network.
- Reduce transitions across boundaries.
- Consider asynchronous communication.
- Consider message queuing.
- Consider a fire and forget invocation model.
Concurrency
- Reduce contention by minimizing lock times.
- Balance between coarse- and fine-grained locks.
- Choose an appropriate transaction isolation level.
- Avoid long-running atomic transactions.
Data Structures and Algorithms
- Choose an appropriate data structure.
- Pre-assign size for large dynamic growth data types.
- Use value and reference types appropriately.
Resource Management
- Treat threads as a shared resource.
- Pool shared or scarce resources.
- Acquire late, release early.
- Consider efficient object creation and destruction.
- Consider resource throttling.
State Management
- Evaluate stateful versus stateless design.
- Consider your state store options.
- Minimize session data.
- Free session resources as soon as possible.
- Avoid accessing session variables from business logic.
Desktop Application Considerations
Browser Client Considerations
- Force the user to enter detailed search criteria.
- Implement client-side validation.
- Display a progress bar for long-running operations.
- Avoid complex pages.
- Render output in stages.
- Minimize image size and number of images.
Web Layer Considerations
- Consider state management implications.
- Consider how you build output.
- Implement paging.
- Minimize or avoid blocking calls.
- Keep objects close together where possible.
Business Layer Considerations
- Instrument your code up front.
- Prefer a stateless design.
- Partition your logic.
- Free shared resources as soon as possible.
Data Access Layer Considerations
- Consider abstraction versus performance.
- Consider resource throttling.
- Consider the identities you flow to the database.
- Separate read-only and transactional requests.
- Avoid unnecessary data returns.