Browse Chunks

Showing 5501-5550 of 7392 chunks

Fibonacci Backoff
CAT_7

Fibonacci Backoff is a retry strategy where the delay between successive attempts follows the Fibonacci sequence. It addresses the problem of overwhelming a service with rapid retries after transient failures. It is used when an operation has failed and the client wants to pause increasingly longer intervals before retrying, without the exponential growth of exponential backoff.

operation fails → wait Fibonacci interval → retry operation

Truncated Exponential Backoff
CAT_7

Truncated exponential backoff is a retry algorithm that increases the wait time between successive attempts exponentially while capping the maximum delay. It addresses the pain of overwhelming a service with rapid retries after transient failures. It is used when a client repeatedly encounters errors such as timeouts or HTTP 5xx responses and needs to back off gracefully.

attempt request → compute delay = min(max_delay, base_delay * 2^retry_count) → sleep → retry

Constant Backoff
CAT_7

Constant backoff is a simple retry strategy where a fixed delay is inserted between each attempt to recover from a transient failure. It is used when the failure is expected to be short-lived and a constant pause is sufficient to allow the service to recover.

retry operation → wait fixed interval → repeat until success or max attempts

Linear Backoff
CAT_7

Linear backoff is a retry strategy where the wait time between successive attempts increases by a fixed amount each time. It addresses the pain point of overwhelming a service with rapid repeated requests after failures. It is typically used when a transient error occurs and the client wants to give the server progressively more time to recover.

measure latency → compute delay = base_delay + step * retry_count → wait for delay

Polynomial Backoff
CAT_7

Polynomial backoff is a retry algorithm that increases the wait time between attempts according to a polynomial function of the attempt number. It mitigates the pain of overwhelming a service with rapid retries after transient failures. It is typically employed when a client has experienced several consecutive errors and needs to pause longer before the next try.

calculate delay → wait → retry operation

Adaptive Backoff
CAT_7

Adaptive backoff is a retry strategy that progressively increases the waiting time between successive attempts after a failure. It mitigates the pain of overwhelming a failing service with rapid retries and reduces contention. It is used when an operation may transiently fail, such as network requests or database connections.

def retry_with_backoff(operation, max_retries, base_delay, factor, jitter=0): for attempt in range(max_retries): try: return operation() except Exception: delay = base_delay * (factor ** attempt) + random.uniform(0, jitter) time.sleep(delay) raise Exception("Maximum retries exceeded")

Thread pool bulkhead
CAT_7

A thread pool bulkhead is a resilience pattern that isolates a service's thread pool to limit concurrent executions, preventing a slow or failing dependency from exhausting all threads and causing system-wide latency or failure.

define bulkhead thread pool → submit tasks → enforce concurrency limit

Process bulkhead
CAT_7

The bulkhead pattern isolates resources such as threads, memory, or connections to prevent a failure in one component from cascading to others. It limits concurrent access to a protected resource, ensuring that excessive load or faults are contained within a designated 'bulkhead'.

assign dedicated resources → limit concurrent access → isolate faults

Container bulkhead
CAT_7

A container bulkhead isolates the resources and failures of one container from others, preventing a single faulty service from exhausting shared system resources. It addresses the pain point of cascading failures in microservice architectures where one overloaded container can degrade the entire host. Developers apply this pattern when deploying multiple containers on the same host or orchestrator and need fault isolation.

monitor container health → enforce bulkhead limits → isolate faulty container

Fiber bulkhead
CAT_7

A fiber bulkhead is a resilience pattern that isolates groups of lightweight execution contexts (fibers) behind a fixed-size resource pool, preventing one noisy or failing component from exhausting system resources. It addresses the pain point of cascading failures in highly concurrent applications where a single overload can starve other tasks. You reach for it when you need to guarantee that a misbehaving service or task cannot affect the overall system's responsiveness.

spawn fiber → assign to dedicated bulkhead → execute task → release fiber

Network connection bulkhead
CAT_7

...

...

Database connection bulkhead
CAT_7

A bulkhead isolates a set of database connections behind a dedicated resource boundary, preventing failures in one part of the system from exhausting the entire connection pool. It addresses the pain point of cascading failures when a downstream database becomes slow or unavailable. The pattern is applied when a service interacts with multiple databases or when different request classes require separate connection limits.

Initialize isolated connection pool → assign to component → monitor health → fallback on failure

Service bulkhead
CAT_7

The service bulkhead pattern isolates critical system resources to prevent failures in one component from cascading to others. By allocating separate thread pools, semaphores, or physical instances for different services, a bulkhead limits the impact of resource exhaustion. It is commonly used in microservices and distributed systems to improve fault tolerance.

Isolate service resources using a bulkhead to limit failure impact.

API bulkhead
CAT_7

An API bulkhead is a resilience pattern that isolates calls to a service or resource so that failures in one API consumer do not exhaust shared resources (like threads, connections, or memory) and cause a system-wide overload. By allocating separate pools or limits per caller, it prevents cascading failures and improves fault isolation.

configure bulkhead isolation for API calls

Message queue bulkhead
CAT_7

A bulkhead isolates components that consume from a message queue so that failures or overload in one consumer do not affect others. It addresses the pain point of cascading failures in distributed, event‑driven systems. You reach for it when a service processes messages from a shared queue and you need to protect the rest of the system from a misbehaving consumer.

define bulkhead limits → allocate separate queues or semaphores per consumer → monitor health and back‑pressure

Event loop bulkhead
CAT_7

An event loop bulkhead isolates a set of asynchronous tasks behind a bounded execution pool, preventing a misbehaving task from exhausting the loop's resources. It addresses the pain point of a single faulty coroutine or I/O operation causing the entire event‑driven system to stall or crash. You reach for it when you need to protect the responsiveness of an event‑driven server under load or when integrating external services that may hang.

create bulkhead → submit event‑loop tasks → enforce capacity

connect timeout
CAT_7

A connect timeout defines the maximum duration to wait while establishing a network connection before aborting. It addresses the problem of applications hanging indefinitely when a remote host is unreachable or slow to respond. It is applied whenever a client initiates a socket, HTTP, or database connection and needs a timely failure.

set connect timeout → attempt connection → abort if timeout expires

socket timeout
CAT_7

A socket timeout defines the maximum period a network socket will block while waiting for an operation (such as connect, send, or receive) before raising a timeout exception. It addresses the pain point of programs hanging indefinitely when a remote endpoint is unresponsive. It is typically used when establishing or communicating over a network where latency or failure is possible.

set socket timeout → handle potential delays → ensure graceful fallback

request timeout
CAT_7

A request timeout limits how long a client will wait for a response from a server before aborting the operation. It prevents indefinite blocking when the remote service is slow, unreachable, or misbehaving. Developers reach for a timeout when network latency or reliability is uncertain and they need to keep the application responsive.

set timeout → send request → handle timeout exception

read timeout
CAT_7

A read timeout limits the maximum time a program will wait for data to be read from a source such as a socket or file. It prevents the application from hanging indefinitely when the peer is unresponsive or the I/O device stalls. The timeout is applied whenever a read operation is initiated and the caller needs to guarantee progress.

set read timeout → attempt read → handle timeout exception

write timeout
CAT_7

A write timeout limits the maximum time a program will wait for a write operation to complete before aborting. It prevents the application from hanging indefinitely when the destination is slow or unresponsive. It is typically applied when performing network I/O, file writes, or any buffered output that may block.

set write timeout → apply to I/O object → handle timeout exception

fallback
CAT_7

A fallback provides an alternative execution path when the primary resource or operation fails. It addresses the pain point of service disruption by offering a safe default or secondary implementation. It is triggered whenever a call to the main component returns an error, is unavailable, or yields an unsuitable result.

detect failure → select fallback implementation → continue processing

graceful degradation
CAT_7

Graceful degradation is a design strategy that provides reduced functionality when a system cannot support the full feature set. It addresses the pain point of broken user experiences caused by missing capabilities or limited resources. It is triggered when a required dependency is unavailable, hardware constraints are detected, or runtime conditions prevent full operation.

detect missing capability → switch to fallback implementation → maintain core functionality

failover
CAT_7

Failover is the process of automatically transferring service responsibilities from a primary component to a standby backup when the primary fails. It addresses the pain point of service interruption caused by hardware, software, or network failures. Engineers invoke failover when health checks detect that the primary node is unresponsive or degraded.

detect primary failure → promote standby → redirect traffic

request hedging
CAT_7

Request hedging is a latency‑optimization technique where the same request is sent to multiple replicas of a service, and the first response is used while the others are cancelled. It reduces tail latency by exploiting variability in service response times. Use it when services are idempotent and can tolerate the extra load.

send request to multiple replicas → use first response → cancel others

stale-while-revalidate
CAT_7

Stale‑while‑revalidate (SWR) is a caching strategy where a cached response is served immediately even if it is stale, while a background request fetches fresh data to update the cache. It reduces latency for the user by avoiding waiting for network fetches, and it keeps data eventually consistent. The pattern is used when the application can tolerate slightly out‑of‑date information but wants to keep the cache up to date without blocking the request.

read from cache → return cached value (even if stale) → trigger async refresh → update cache

dead letter queue
CAT_7

A dead‑letter queue (DLQ) is a secondary queue that stores messages which could not be successfully processed by the main consumer. It addresses the pain point of message loss when handling malformed data, repeated processing failures, or downstream service outages. It is typically used when a message repeatedly triggers an error or exceeds a retry limit, prompting the system to move it to the DLQ for later inspection.

producer → main queue → dead‑letter queue ← consumer on failure

sliding window
CAT_7

The sliding window technique maintains a contiguous subset of data (a window) that moves linearly through the input. By adjusting the window's start and end indices, you can evaluate constraints efficiently without revisiting elements, turning quadratic brute-force scans into linear-time algorithms.

Use two pointers (start, end) to represent a window; expand end to include new element, then contract start while condition violated.

Continuous Integration
CAT_8

Continuous Integration (CI) automatically builds and tests code changes each time they are committed to a shared repository. It addresses the pain point of integration hell by providing early feedback on broken builds. Developers trigger CI whenever they push commits or open a pull request, ensuring the codebase remains healthy.

push → CI server runs build and tests → results reported to developers

Continuous Deployment
CAT_8

Continuous Deployment is an engineering practice where code changes that pass automated tests are automatically released to production without human intervention. It addresses the pain point of slow, error‑prone manual releases by eliminating manual approval steps. Teams reach for it when they have a reliable CI pipeline, comprehensive automated testing, and need to deliver value to users rapidly.

code commit → CI pipeline → automated deployment to production

Artifact Repository
CAT_8

An artifact repository is a storage system that houses build outputs such as compiled binaries, libraries, and dependencies, typically versioned and indexed for retrieval. It enables teams to share and reuse artifacts across different stages of the software delivery pipeline, ensuring consistency and reproducibility.

store build artifacts in an artifact repository for versioned retrieval

Feature Toggle
CAT_8

A feature toggle (also known as a feature flag) is a software development technique that allows turning specific functionality on or off without deploying new code. It enables teams to release features gradually, perform A/B testing, and roll back problematic features quickly. Toggles are typically managed via configuration files, databases, or dedicated feature flag services.

wrap feature code in a toggle check to enable/disable at runtime

Infrastructure as Code
CAT_8

Infrastructure as Code (IaC) is the practice of managing and provisioning computing infrastructure through machine-readable definition files, rather than through physical hardware configuration or interactive configuration tools. It enables version control, repeatability, and automated deployment of environments using tools such as Terraform, AWS CloudFormation, or Ansible.

write infrastructure definitions in a declarative language → execute with an IaC tool → store definitions in version control

immutable infrastructure
CAT_8

Immutable infrastructure is a practice where servers and environments are never modified after deployment; instead, any change requires provisioning a new instance and decommissioning the old one. It addresses the pain of configuration drift and unpredictable state that accumulates when systems are patched in place. This approach is triggered when a new version of an application or configuration needs to be released, prompting a full rebuild of the infrastructure.

define immutable image → deploy to environment → replace old instances

Artifact Promotion
CAT_8

Artifact promotion moves a built software package from a lower‑trust repository (e.g., a staging or snapshot repo) to a higher‑trust target (such as a release repository or production environment). It solves the pain point of manually copying or re‑uploading binaries, which is error‑prone and slows down delivery pipelines. The process is triggered after a successful build and validation stage in a CI/CD workflow.

build artifact → validate → promote to target repository

gitflow
CAT_8

Gitflow is a branching model for Git that defines a set of rules and branch roles to manage parallel development, releases, and hotfixes. It uses long-lived branches (main, develop) and short-lived support branches (feature, release, hotfix) to isolate work. Teams adopt Gitflow when they need a structured release process and clear versioning.

Use main branch for production releases, develop branch for integration, feature branches off develop, release branches off develop, hotfix branches off main.

trunk-based development
CAT_8

Trunk-based development is a source‑control branching strategy where developers commit directly to a single main branch (the “trunk”) and keep feature work short‑lived. It addresses the pain of long‑running feature branches that cause integration conflicts and delayed feedback. Teams reach for it when they need rapid, continuous integration and frequent releases.

Develop on the main branch, integrate small changes continuously, release frequently.

github flow
CAT_8

GitHub Flow defines a lightweight, branch‑based workflow for collaborating on code hosted on GitHub. It addresses the pain of coordinating frequent releases by using short‑lived feature branches and pull‑request reviews. Developers reach for it when they need continuous delivery with minimal overhead.

Create feature branch → commit changes → push → open pull request → merge after review

release branching
CAT_8

Release branching is a version‑control strategy where a separate branch is created from the main line to prepare a software release. It allows stabilization, testing, and bug fixing while development continues on the main branch.

create a release branch from main → stabilize and test → tag the release → merge back to main (and optionally develop)

feature branching
CAT_8

Feature branching is a version‑control technique where a developer creates a separate branch to develop a new feature isolated from the main line of development. It mitigates the risk of destabilising the stable codebase and simplifies integration of incomplete work. Developers reach for it when they need to work on a change that should not affect production until it is fully tested and reviewed.

Create a feature branch → develop changes → open a pull request → merge after review

gitlab flow
CAT_8

GitLab Flow is a branching and integration workflow that ties feature development to merge requests and CI pipelines. It addresses the pain of coordinating code changes, reviews, and deployments in a single cohesive process. It is triggered when a team wants to ensure that every change is tested, reviewed, and can be released safely.

feature branch → open merge request → CI pipeline runs → merge to main → deploy

Extract Method
CAT_9

Extract Method creates a new method from a selected code fragment and replaces the fragment with a call to the new method. It addresses long, complex methods that violate the Single Responsibility Principle and are hard to read, test, or reuse. Developers apply it when a method has grown too large, contains duplicated logic, or performs a distinct conceptual step that could be named.

Identify a cohesive code block → create a new method with needed parameters → replace the block with a call to the new method.

Inline Method
CAT_9

Inline Method replaces a method call with the method's body, eliminating the indirection. It addresses the pain of unnecessary method overhead and improves code clarity when a method is trivial and not reused. You reach for this refactoring when a method's body is short, clear, and called in only one place.

Replace a method call with the method's body, removing the call.

Rename Variable
CAT_9

Renaming a variable changes its identifier throughout its lexical scope while preserving its value and behavior. This resolves confusion caused by misleading or non-descriptive names that hinder code readability and maintenance. Developers apply this refactoring when a variable's name no longer reflects its purpose, during code reviews, or when adapting code to new requirements.

identify variable → choose new name → apply rename across scope

Replace Magic Number with Symbolic Constant
CAT_9

Replace hard-coded numeric literals (magic numbers) with named constants to improve code readability and maintainability.

Replace magic number with named constant

Extract Class
CAT_9

A refactoring technique that moves responsibilities from an overloaded class into a new, focused class to improve cohesion and reduce coupling.

Extract Class

Move Method
CAT_9

Move Method is a refactoring technique that relocates a method from the class where it is currently defined to another class where it has a stronger relationship, typically because the method uses or is used more by features of the target class.

Move a method from its current class to another class where it has a stronger relationship, updating all call sites to invoke the method on the target class (or via delegation).

Replace Conditional with Polymorphism
CAT_9

Replace conditional logic with polymorphism to eliminate duplicated conditionals and improve maintainability.

Replace conditional with polymorphism

Introduce Parameter Object
CAT_9

Introduce Parameter Object is a refactoring technique where multiple related parameters are replaced by a single parameter object, simplifying method signatures and improving maintainability.

Replace a group of parameters with a parameter object (often a simple data class or struct).

Replace Nested Conditional with Guard Clauses
CAT_9

Guard clauses are early return statements placed at the start of a function to handle invalid or edge-case inputs. They reduce nesting by exiting early when conditions are not met, improving readability. Developers reach for guard clauses when a function begins with multiple nested conditionals that check input validity.

Place guard clauses at the function start to return early for invalid inputs.