Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit d5fb9e6

Browse files
committed
Raise Durable Object storage max value size from 32KiB to 128KiB
1 parent 12027de commit d5fb9e6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

packages/durable-objects/src/storage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import { ShadowStorage } from "./shadow";
1414

1515
const MAX_KEYS = 128;
1616
const MAX_KEY_SIZE = 2048; /* 2KiB */
17-
const MAX_VALUE_SIZE = 32 * 1024; /* 32KiB */
17+
const MAX_VALUE_SIZE = 128 * 1024; /* 128KiB */
1818
// As V8 serialisation adds some tagging information, Workers actually allows
19-
// values to be 32 bytes greater than the advertised limit. This allows 32KiB
19+
// values to be 32 bytes greater than the advertised limit. This allows 128KiB
2020
// byte arrays to be stored for example.
2121
const ENFORCED_MAX_VALUE_SIZE = MAX_VALUE_SIZE + 32;
2222

packages/durable-objects/test/storage.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,15 +404,15 @@ test("put: validates values", async (t) => {
404404
};
405405
const largeValueSingleExpectation: ThrowsExpectation = {
406406
instanceOf: RangeError,
407-
message: "Values cannot be larger than 32768 bytes.",
407+
message: "Values cannot be larger than 131072 bytes.",
408408
};
409409
const largeValueManyExpectation: ThrowsExpectation = {
410410
instanceOf: RangeError,
411-
message: 'Value for key "large" is above the limit of 32768 bytes.',
411+
message: 'Value for key "large" is above the limit of 131072 bytes.',
412412
};
413413

414-
const maxValue = new Uint8Array(32 * 1024); // This should be storable
415-
const largeValue = new Uint8Array(32 * 1024 + 32);
414+
const maxValue = new Uint8Array(128 * 1024); // This should be storable
415+
const largeValue = new Uint8Array(128 * 1024 + 32);
416416

417417
// Note we're checking put throws synchronously
418418
t.throws(() => storage.put("key", undefined), undefinedExpectation);

0 commit comments

Comments
 (0)