From e436b4b4aa6fef39396b3b5d444e620bc58f7433 Mon Sep 17 00:00:00 2001 From: Rasmus Rendal Date: Fri, 1 Aug 2025 11:01:32 +0200 Subject: [PATCH] Partitioning: Use more consistent language regarding partitions and buckets In the current state, a partition consists of partitions, which is quite confusing. This PR changes that, such that a partition consists of buckets. --- nats-concepts/subject_mapping.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nats-concepts/subject_mapping.md b/nats-concepts/subject_mapping.md index 2f678b1f..38dea1e6 100644 --- a/nats-concepts/subject_mapping.md +++ b/nats-concepts/subject_mapping.md @@ -257,7 +257,7 @@ Examples: Deterministic token partitioning allows you to use subject-based addressing to deterministically divide (partition) a flow of messages where one or more of the subject tokens is mapped into a partition key. Deterministically means, the same tokens are always mapped into the same key. The mapping will appear random and may not be `fair` for a small number of subjects. -For example: new customer orders are published on `neworders.`, you can partition those messages over 3 partition numbers (buckets), using the `partition(number of partitions, wildcard token positions...)` function which returns a partition number (between 0 and number of partitions-1) by using the following mapping `"neworders.*" : "neworders.{{wildcard(1)}}.{{partition(3,1)}}"`. +For example: new customer orders are published on `neworders.`, you can partition those messages over 3 partition numbers (buckets), using the `partition(number of buckets, wildcard token positions...)` function which returns a partition number (between 0 and number of partitions-1) by using the following mapping `"neworders.*" : "neworders.{{wildcard(1)}}.{{partition(3,1)}}"`. ``` nats server mapping "neworders.*" "neworders.{{wildcard(1)}}.{{partition(3,1)}}" neworders.customerid1 @@ -265,7 +265,7 @@ nats server mapping "neworders.*" "neworders.{{wildcard(1)}}.{{partition(3,1)}}" ``` {% hint style="info" %} -Note that multiple token positions can be specified to form a kind of _composite partition key_. For example, a subject with the form `foo.*.*` can have a partition transform of `foo.{{wildcard(1)}}.{{wildcard(2)}}.{{partition(5,1,2)}}` which will result in five partitions in the form `foo.*.*.`, but using the hash of the two wildcard tokens when computing the partition number. +Note that multiple token positions can be specified to form a kind of _composite partition key_. For example, a subject with the form `foo.*.*` can have a partition transform of `foo.{{wildcard(1)}}.{{wildcard(2)}}.{{partition(5,1,2)}}` which will result in five buckets in the form `foo.*.*.`, but using the hash of the two wildcard tokens when computing the partition number. ``` nats server mapping "foo.*.*" "foo.{{wildcard(1)}}.{{wildcard(2)}}.{{partition(5,1,2)}}" foo.us.customerid @@ -284,9 +284,9 @@ This particular transform means that any message published on `neworders.