Skip to content

Instantly share code, notes, and snippets.

@leodutra
Last active November 7, 2021 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leodutra/b879192a2a36d91b5341cf679d08106b to your computer and use it in GitHub Desktop.
Save leodutra/b879192a2a36d91b5341cf679d08106b to your computer and use it in GitHub Desktop.
Performance patterns & Self-Healing Techniques

Performance Patterns

Definitions:

Express Train

For some tasks, create an alternate path that does only the minimal required work (e.g., for data fetches requiring maximum performance, create multiple DAOs — some enriched, some impoverished)

Hard Sequence

Enforce sequential completion of high-priority tasks, even if multiple threads are available (e.g., chain Ajax calls enabling optional interactions only after minimal page load, even if later calls do not physically depend on earlier returns)

Batching

Chunk similar tasks together to avoid spin-up/spin-down overhead (e.g., create a service that monitors a queue of vectorizable tasks and groups them into one vectorized process once some threshold count is reached)

Interface Matching

For tasks commonly accessed through a particular interface, create a coarse-grained object that combines anything required for tasks defined by the interface (e.g., for an e-commerce cart, create a CartDecorated object that handles all cart-related calculations and initializes with all data required for these calculations)

Copy-Merge

For tasks using the same physical resource, distribute multiple physical copies of the resource and reconcile in a separate process if needed (e.g., database sharding)

Calendar Control

When workload timing can be predicted, block predicted work times from schedulers so that simultaneous demand does not exceed available resources

Self-Healing Techniques

Retry
Circuit breaker
Backoff
Critical resource isolation
Failover
Queue-based load leveling
Client throttling
Leader election
Chaos engineering
Graceful degradation
Long-running transaction checkpoints
Compensating transactions
Database snapshotting
Reserved healing layer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment