Skip to content

Commit e5c91d2

Browse files
torosentCopilot
andcommitted
Change default large-payload threshold to 256 KiB (262,144 bytes)
Mirror the .NET SDK default change (microsoft/durabletask-dotnet#755): lower LargePayloadStorageOptions.threshold_bytes from 900,000 to 262,144 bytes (256 KiB). Update the example (raise the demo payload so it still externalizes above the new threshold), repo docs, and the default-value test. Behavioral change, not source/binary breaking. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 6f56f6f commit e5c91d2

9 files changed

Lines changed: 20 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## Unreleased
99

10+
CHANGED
11+
12+
- Changed the default large-payload externalization threshold (`LargePayloadStorageOptions.threshold_bytes`) from 900,000 bytes to 262,144 bytes (256 KiB), matching the .NET SDK default. Behavioral change (not source/binary breaking): payloads larger than 256 KiB are now externalized by default.
13+
1014
## v1.7.0
1115

1216
ADDED

docs/features.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ pip install durabletask[azure-blob-payloads]
285285
#### How it works
286286

287287
1. When the worker or client sends a payload that exceeds the
288-
configured threshold (default 900 KB), the payload is
288+
configured threshold (default 256 KiB), the payload is
289289
compressed (GZip, enabled by default) and uploaded to the
290290
external store.
291291
2. The original payload in the gRPC message is replaced with a
@@ -307,7 +307,7 @@ from durabletask.extensions.azure_blob_payloads import BlobPayloadStore, BlobPay
307307
store = BlobPayloadStore(BlobPayloadStoreOptions(
308308
connection_string="DefaultEndpointsProtocol=https;...",
309309
container_name="durabletask-payloads", # default
310-
threshold_bytes=900_000, # default (900 KB)
310+
threshold_bytes=262_144, # default (256 KiB)
311311
max_stored_payload_bytes=10_485_760, # default (10 MB)
312312
enable_compression=True, # default
313313
))
@@ -351,7 +351,7 @@ store = BlobPayloadStore(BlobPayloadStoreOptions(
351351

352352
| Option | Default | Description |
353353
|---|---|---|
354-
| `threshold_bytes` | 900,000 (900 KB) | Payloads larger than this are externalized |
354+
| `threshold_bytes` | 262,144 (256 KiB) | Payloads larger than this are externalized |
355355
| `max_stored_payload_bytes` | 10,485,760 (10 MB) | Maximum size for externalized payloads |
356356
| `enable_compression` | `True` | GZip-compress payloads before uploading |
357357
| `container_name` | `"durabletask-payloads"` | Azure Blob container name |

docs/supported-patterns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ with DurableTaskSchedulerWorker(
217217
state = c.wait_for_orchestration_completion(instance_id, timeout=60)
218218
```
219219

220-
In this example, any payload exceeding the threshold (default 900 KB) is compressed and uploaded to
220+
In this example, any payload exceeding the threshold (default 256 KiB) is compressed and uploaded to
221221
the configured Azure Blob container. When the worker or client reads the message, it downloads and
222222
decompresses the payload automatically.
223223

durabletask/payload/store.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ class LargePayloadStorageOptions:
2121
2222
Attributes:
2323
threshold_bytes: Payloads larger than this value (in bytes) will
24-
be externalized to the payload store. Defaults to 900,000
25-
(900 KB), matching the .NET SDK default.
24+
be externalized to the payload store. Defaults to 262,144
25+
(256 KiB), matching the .NET SDK default.
2626
max_stored_payload_bytes: Maximum payload size (in bytes) that
2727
can be stored externally. Payloads exceeding this limit
2828
will cause an error. Defaults to 10,485,760 (10 MB).
2929
enable_compression: When ``True`` (the default), payloads are
3030
GZip-compressed before uploading.
3131
"""
32-
threshold_bytes: int = 900_000
32+
threshold_bytes: int = 262_144
3333
max_stored_payload_bytes: int = 10 * 1024 * 1024 # 10 MB
3434
enable_compression: bool = True
3535

examples/large_payload/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ python app.py
7878
The example schedules two orchestrations:
7979

8080
- **Small payload** — The input and output stay inline in the gRPC
81-
messages (below the 1 KB threshold configured in the example).
82-
- **Large payload** — The activity output (~70 KB) exceeds the
81+
messages (below the 256 KiB threshold configured in the example).
82+
- **Large payload** — The activity output (~342 KB) exceeds the
8383
threshold and is automatically externalized to blob storage and
8484
retrieved transparently.
8585

@@ -106,7 +106,7 @@ The `BlobPayloadStoreOptions` class supports the following settings:
106106

107107
| Option | Default | Description |
108108
|---|---|---|
109-
| `threshold_bytes` | 900,000 (900 KB) | Payloads larger than this are externalized |
109+
| `threshold_bytes` | 262,144 (256 KiB) | Payloads larger than this are externalized |
110110
| `max_stored_payload_bytes` | 10,485,760 (10 MB) | Maximum externalized payload size |
111111
| `enable_compression` | `True` | GZip-compress before uploading |
112112
| `container_name` | `"durabletask-payloads"` | Blob container name |

examples/large_payload/app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ def main():
8181
# Configure the blob payload store
8282
store = BlobPayloadStore(BlobPayloadStoreOptions(
8383
connection_string=storage_conn_str,
84-
# Use a low threshold so that we can see externalization in action
85-
threshold_bytes=1_024,
84+
# 256 KiB, matching the SDK default; larger payloads are externalized
85+
threshold_bytes=262_144,
8686
))
8787

8888
secure_channel = endpoint.startswith("https://")
@@ -120,7 +120,7 @@ def main():
120120
# (the report will be externalized to blob storage automatically)
121121
print("\n--- Large payload (externalized to blob storage) ---")
122122
instance_id = c.schedule_new_orchestration(
123-
large_payload_orchestrator, input=10_000)
123+
large_payload_orchestrator, input=50_000)
124124
state = c.wait_for_orchestration_completion(instance_id, timeout=60)
125125
if state and state.runtime_status == client.OrchestrationStatus.COMPLETED:
126126
print(f"Result: {state.serialized_output}")

tests/durabletask-azuremanaged/test_dts_large_payload_e2e.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
TEST_CONTAINER = f"dts-payloads-{uuid.uuid4().hex[:8]}"
4646

4747
# A low threshold so we can trigger externalization without massive strings.
48-
# In production the default is 900 KB; here we use 1 KB for fast tests.
48+
# In production the default is 256 KiB; here we use 1 KB for fast tests.
4949
THRESHOLD_BYTES = 1_024
5050

5151
# Pin API version to one that Azurite supports.

tests/durabletask/test_large_payload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def test_default_options(self):
421421
connection_string="UseDevelopmentStorage=true",
422422
))
423423
opts = store.options
424-
assert opts.threshold_bytes == 900_000
424+
assert opts.threshold_bytes == 262_144
425425
assert opts.max_stored_payload_bytes == 10 * 1024 * 1024
426426
assert opts.enable_compression is True
427427
assert opts.container_name == "durabletask-payloads"

tests/durabletask/test_large_payload_e2e.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
TEST_CONTAINER = f"e2e-payloads-{uuid.uuid4().hex[:8]}"
4040

4141
# A low threshold so we can trigger externalization without massive strings.
42-
# In production the default is 900 KB; here we use 1 KB for fast tests.
42+
# In production the default is 256 KiB; here we use 1 KB for fast tests.
4343
THRESHOLD_BYTES = 1_024
4444

4545
# Pin API version to one that Azurite supports.

0 commit comments

Comments
 (0)