Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions patterns/08-cloud-distributed/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Origin. Azure Architecture Center, Nygard

44 entries, 393,059 words. Every entry carries all 18
44 entries, 393,060 words. Every entry carries all 18
dimensions from [the entry contract](../../docs/ENTRY-TEMPLATE.md).

## Capacity Management
Expand Down Expand Up @@ -137,7 +137,7 @@ dimensions from [the entry contract](../../docs/ENTRY-TEMPLATE.md).
| [Competing Consumers](competing-consumers.md) | canonical | 7,217 | A system produces units of work faster, or in bursts larger, than a single consumer process can absorb, and the units of work are independent of one another, meaning any one of ... |
| [Priority Queue](priority-queue.md) | canonical | 10,299 | A distributed system that processes work through a queue, whether that queue is a message broker topic, a job table, a task list, or a pending pod list, eventually accumulates ... |
| [Queue-Based Load Leveling](queue-based-load-leveling.md) | canonical | 9,730 | A system accepts work at a rate that varies over time, sometimes sharply, while the component that actually performs the work has a roughly fixed processing capacity per unit time. |
| [Rate Limiting](rate-limiting.md) | canonical | 10,988 | A service exposes an operation that costs something to perform. |
| [Rate Limiting](rate-limiting.md) | canonical | 10,989 | A service exposes an operation that costs something to perform. |
| [Throttling](throttling.md) | canonical | 10,477 | A service exposes an operation that costs something to run. |

## Security
Expand Down
83 changes: 42 additions & 41 deletions patterns/08-cloud-distributed/rate-limiting.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,47 +249,48 @@ from a wall into a protocol.
## 6. ASCII structure diagram

```
,-------------------------.
inbound request ---> | Enforcement Point |
| (gateway / middleware) |
`------------+------------'
|
(1) key v
,--------------------------------------------------.
| Identity Extractor |
| api key > account > session > net addr (/64) |
`----------------------+---------------------------'
| key
v
,--------------------------------------------------.
| Policy Resolver |
| route + plan -> {limit, window, burst, cost} |
`----------------------+---------------------------'
| key + policy
v
,--------------------------------------------------.
| Decision Engine | atomic
| token bucket | leaky | fixed | log | sliding |<--> read
`----------------------+---------------------------' modify
| verdict write
| {conform, remaining, reset, |
| retry_after, policy_id} v
| ,---------------------.
,----------------------+--------------. | Quota Store |
| | | in-proc map | Redis |
v v | | DynamoDB | mesh |
,-----------. ,---------------. `---------------------'
| handler | | Response |
| (admitted)| | Annotator |
`-----------' | 429 + headers |
`-------+-------'
|
v
,---------------------.
| Client Governor |
| wait, jitter, self |
| throttle, retry |
`---------------------'
+------------------------------------------+
| Enforcement Point, gateway or middleware |
+------------------------------------------+
^ inbound request
|
v
+-----------------------------------------------------+
| Identity Extractor |
| api key over account over session over /64 net addr |
+-----------------------------------------------------+
| key
v
+--------------------------------------------+
| Policy Resolver |
| route + plan -> limit, window, burst, cost |
+--------------------------------------------+
| key + policy
v
+-----------------------------------------------+
| Decision Engine |
| token bucket, leaky, fixed, log, or sliding |
| reads and modifies the Quota Store atomically |
+-----------------------------------------------+
| verdict, conform or deny, plus remaining,
| reset, retry_after, and policy_id
v
conform? yes -> handler (admitted)
conform? no -> Response Annotator

+-------------------------------------------+
| Response Annotator, sets 429 plus headers |
+-------------------------------------------+
|
v
+---------------------------------------------+
| Client Governor |
| waits, adds jitter, self-throttles, retries |
+---------------------------------------------+

The Decision Engine's atomic read, modify, write cycle
runs against the Quota Store, an in-process map, Redis,
DynamoDB, or a mesh sidecar, held out of this chain.
```

## 7. Dynamics
Expand Down
4 changes: 2 additions & 2 deletions patterns/09-concurrency/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Origin. Schmidt POSA 2

40 entries, 318,562 words. Every entry carries all 18
40 entries, 318,550 words. Every entry carries all 18
dimensions from [the entry contract](../../docs/ENTRY-TEMPLATE.md).

## Concurrency
Expand Down Expand Up @@ -41,7 +41,7 @@ dimensions from [the entry contract](../../docs/ENTRY-TEMPLATE.md).
| [Read-Write Lock](read-write-lock.md) | canonical | 7,855 | A single piece of shared, mutable state is accessed by multiple threads. |
| [Scheduler](scheduler.md) | canonical | 6,621 | A system has more units of work that want to run than it has execution resources to run them on, or those units of work become eligible at different and unpredictable times, and ... |
| [Scoped Locking](scoped-locking.md) | canonical | 8,785 | A piece of code acquires a lock to protect a critical section, and every path out of that critical section, the normal return, the early return, the thrown exception, the break ... |
| [Semaphore](semaphore.md) | canonical | 8,341 | A fixed, known number of interchangeable resources exist. |
| [Semaphore](semaphore.md) | canonical | 8,329 | A fixed, known number of interchangeable resources exist. |
| [Strategized Locking](strategized-locking.md) | canonical | 9,027 | A reusable component, a cache, a connection pool, a queue, a counter, a buffer manager, is built once and deployed into more than one concurrency environment. |
| [Structured Concurrency](structured-concurrency.md) | established | 7,965 | A function spawns concurrent work, a network call, a background computation, a fan-out to several services, and returns before that work is guaranteed to be done. |
| [Thread Pool](thread-pool.md) | canonical | 7,592 | A server, or any long-running process, receives a stream of independent units of work. |
Expand Down
61 changes: 28 additions & 33 deletions patterns/09-concurrency/semaphore.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,39 +225,34 @@ failure modes in dimension 11.
## 6. ASCII structure diagram

```
+--------------------------+
| Semaphore |
|----------------------------|
| counter: int (permits left)|
| waitSet: queue of Waiter |
|----------------------------|
| + acquire() |
| + tryAcquire(): bool |
| + acquire(timeout): bool |
| + release() |
+--------------------------+
^ |
acquire() | | wakes on release()
blocks if | v
counter=0 | +----------------+
| | Waiter A |
| | (blocked task) |
| +----------------+
|
| +----------------+
+-------->| Waiter B |
| (blocked task) |
+----------------+

Holder 1 -- acquire() --> [permit 1 taken] --> uses resource --> release()
Holder 2 -- acquire() --> [permit 2 taken] --> uses resource --> release()
Holder 3 -- acquire() --> counter is 0, BLOCKS ---------------> woken here
when a
permit
frees up

A semaphore initialised with N permits admits up to N concurrent
holders. Holder N+1 blocks in the wait set until any holder releases.
+------------------------------------------------------+
| Semaphore |
| counter: int, permits left |
| waitSet: queue of Waiter |
| acquire(), tryAcquire(), acquire(timeout), release() |
+------------------------------------------------------+
^ blocks and enqueues here when counter is 0
|
+------------------------+
| Waiter A, blocked task |
+------------------------+
+------------------------+
| Waiter B, blocked task |
+------------------------+

Each blocked Waiter is woken in turn when a holder
calls release() and a permit frees up.

A semaphore initialised with N permits admits up to N
concurrent holders. Holder N+1 blocks in the wait set
until any holder releases.

Holder 1. acquire() -> permit 1 taken -> uses resource
-> release()
Holder 2. acquire() -> permit 2 taken -> uses resource
-> release()
Holder 3. acquire() -> counter is 0, BLOCKS -> woken
only when a permit frees up
```

## 7. Dynamics
Expand Down
4 changes: 2 additions & 2 deletions patterns/10-microservices/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Origin. Richardson

49 entries, 364,349 words. Every entry carries all 18
49 entries, 364,269 words. Every entry carries all 18
dimensions from [the entry contract](../../docs/ENTRY-TEMPLATE.md).

## Antipattern
Expand Down Expand Up @@ -60,7 +60,7 @@ dimensions from [the entry contract](../../docs/ENTRY-TEMPLATE.md).
| Pattern | Maturity | Words | Intent |
|---|---|---|---|
| [Multiple Service Instances per Host](multiple-service-instances-per-host.md) | established | 7,536 | A single instance of a service process can only accept as many concurrent connections and use as many CPU cycles as one operating system process gets scheduled. |
| [Serverless Deployment](serverless-deployment.md) | established | 7,884 | A team owns a piece of business logic that is genuinely small and genuinely bursty. |
| [Serverless Deployment](serverless-deployment.md) | established | 7,804 | A team owns a piece of business logic that is genuinely small and genuinely bursty. |
| [Service Deployment Platform](service-deployment-platform.md) | canonical | 7,181 | A team has decomposed an application into a set of independently deployable services, following one of the decomposition patterns in this family, and has chosen how a single ... |
| [Service Instance per Container](service-instance-per-container.md) | canonical | 8,934 | A team is moving an application, or building a new one, on top of microservices, and has to decide the packaging and scheduling unit for each service instance. |
| [Service Instance per Host](service-instance-per-host.md) | established | 7,761 | You have already decomposed a system into services, and each service runs as one or more service instances for throughput and redundancy, the same starting context Richardson ... |
Expand Down
61 changes: 24 additions & 37 deletions patterns/10-microservices/serverless-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,43 +240,30 @@ Do NOT reach for it in these cases, and the reason matters more than the rule.
## 6. ASCII structure diagram

```
+----------------------------+
| Trigger source |
| HTTP route / queue / blob |
| notification / schedule |
+--------------+---------------+
|
v
+----------------------------+
| Orchestrator |
| decides. reuse a warm env, |
| or cold-start a new one |
+--------------+---------------+
|
+------------------+------------------+
| |
v v
+----------------------+ +----------------------+
| Execution env #1 | | Execution env #2 |
| (warm, reused) | | (cold-started now) |
| | | |
| +------------------+ | | +------------------+ |
| | Runtime | | | | Runtime | |
| | +-------------+ | | | | +-------------+ | |
| | | Function | | | | | | Function | | |
| | | handler | | | | | | handler | | |
| | +-------------+ | | | | +-------------+ | |
| +------------------+ | | +------------------+ |
+-----------+-----------+ +-----------+-----------+
| |
+------------------+-------------------+
|
v
+----------------------------+
| External state store |
| database / object store / |
| cache / message bus |
+----------------------------+
+---------------------------------------------------------------+
| Trigger source, an HTTP route, queue, blob event, or schedule |
+---------------------------------------------------------------+
|
v
+--------------------------------------------------+
| Orchestrator, decides: reuse a warm env, or cold-start|
+--------------------------------------------------+
| routes to one of two possible envs
v
+--------------------------------+
| Execution env #1, warm, reused |
| Runtime -> Function handler |
+--------------------------------+
+------------------------------------+
| Execution env #2, cold-started now |
| Runtime -> Function handler |
+------------------------------------+
| either env
v
+-------------------------------------------------+
| External state store |
| a database, object store, cache, or message bus |
+-------------------------------------------------+
```

## 7. Dynamics
Expand Down
4 changes: 2 additions & 2 deletions patterns/13-frontend-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Origin. Framework documentation

34 entries, 123,829 words. Every entry carries all 18
34 entries, 123,828 words. Every entry carries all 18
dimensions from [the entry contract](../../docs/ENTRY-TEMPLATE.md).

## Application Architecture
Expand Down Expand Up @@ -101,7 +101,7 @@ dimensions from [the entry contract](../../docs/ENTRY-TEMPLATE.md).
| [Flux](flux.md) | deprecated | 3,629 | Traditional MVC-style architectures let a view update a model directly, and let multiple models observe and update one another, which becomes difficult to reason about as an ... |
| [Reducer Hook](reducer-hook.md) | canonical | 3,580 | A component whose state updates are spread across many individual event handlers, each directly calling its own state setter, becomes hard to reason about as the number of related ... |
| [Redux](redux.md) | canonical | 3,663 | Flux's original architecture solved unidirectional data flow with several independent stores, each holding its own slice of state and its own update logic, which worked but left ... |
| [Signals](signals.md) | established | 3,294 | A component-based UI framework built on a virtual DOM diff and re-render cycle, such as React, re-runs an entire component function whenever any piece of its state changes, then ... |
| [Signals](signals.md) | established | 3,293 | A component-based UI framework built on a virtual DOM diff and re-render cycle, such as React, re-runs an entire component function whenever any piece of its state changes, then ... |
| [State Machine UI](state-machine-ui.md) | established | 3,616 | A component with several loading, error, and success conditions is commonly modeled with several independent boolean flags, such as isLoading, isError, and hasData, tracked as ... |

## Reading order
Expand Down
19 changes: 10 additions & 9 deletions patterns/13-frontend-ui/signals.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,20 @@ Signals have two structural parts.
## 6. ASCII structure diagram

```
count = signal(0) (the signal itself)
count = signal(0) (the signal itself)

|
v read inside a reactive context
|
v read inside a reactive context

<span>{count}</span> (a subscriber, a rendered UI fragment)
doubled = computed(() => count.value * 2) (a subscriber, a derived value)
<span>{count}</span> (a subscriber, a UI fragment)
doubled = computed(() => count.value * 2)
(a subscriber, a derived value)

|
v count.value = 1
|
v count.value = 1

Only the subscribers that actually read count re-evaluate.
A sibling component that never reads count does not re-render.
Only the subscribers that actually read count re-evaluate.
A sibling component that never reads count does not re-render.
```

## 7. Dynamics
Expand Down
4 changes: 2 additions & 2 deletions patterns/16-functional/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Origin. Category theory in practice

39 entries, 240,724 words. Every entry carries all 18
39 entries, 240,720 words. Every entry carries all 18
dimensions from [the entry contract](../../docs/ENTRY-TEMPLATE.md).

## Composition
Expand Down Expand Up @@ -47,7 +47,7 @@ dimensions from [the entry contract](../../docs/ENTRY-TEMPLATE.md).
| [Function Composition](function-composition.md) | canonical | 7,310 | A program has several small transformations that must run in a fixed order. |
| [Functor](functor.md) | canonical | 6,739 | A codebase has many values that are not plain values. |
| [Lazy Evaluation](lazy-evaluation.md) | canonical | 6,415 | A program has a chain of computations, but early execution would do work that may never be observed. |
| [Lens](lens.md) | established | 6,096 | A program owns nested immutable data and needs to update a small part without losing the larger value. |
| [Lens](lens.md) | established | 6,092 | A program owns nested immutable data and needs to update a small part without losing the larger value. |
| [Memoization](memoization.md) | canonical | 6,478 | A program repeatedly asks the same pure question, and each answer costs more than a map lookup. |
| [Monad](monad.md) | canonical | 6,350 | A program has computations that return values inside a policy, and later computations depend on the successful, present, parsed, or completed result of earlier computations. |
| [Monoid](monoid.md) | canonical | 6,362 | A codebase has many places that reduce many values into one value. |
Expand Down
Loading
Loading