Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple stable memory regions (and a new primitive type
Region
). #3768Multiple stable memory regions (and a new primitive type
Region
). #3768Changes from 41 commits
02c4abe
e841f89
bac5505
aeb5a3b
2718a04
17f13b3
109c796
07ec568
e068c14
e95548d
2d69338
2643f7c
78c5f24
456e7a3
21cd5f5
ef1b7f4
00d9293
338ce6c
7624356
ecf89ff
470aedb
7c5d389
6b04983
3effd5c
8c02b4f
cd1db26
db5a640
5402e4c
93c1b99
17a4e72
b1b2c82
e7bbf91
a3d25fd
9dde00f
6d0bc06
7df427c
7409286
a5b8605
b569f9a
fcbf51a
c99e09a
53232e3
0057d44
26add78
5e2bb2a
a8c69e5
8cc2826
b36bc66
5ec3952
dc4aea5
04375f1
3dc7fca
93a088b
d1cc1b7
2861f82
930425d
c29baac
fa17241
e165d36
c4e251d
1540993
284e2e6
bad61c5
58b6b56
b7786a3
08a9b11
6a65db2
87d92a7
489b33a
054b018
028e1a8
b3f5aa5
960b853
5cdbac5
7d0d33d
fe210a5
4c33508
a4a28a9
eb29dd8
3b9d80a
5ddae06
6bccf80
457c41a
0db11ea
56915e5
cbf85bf
c8ac583
41bd43a
1ff83a0
8d87f8a
a249067
3f92146
c8a53fa
b24f65e
9af4831
2362675
6268fb6
b593986
850720c
7da523c
724d631
1d07ce3
7a5767c
912ecfc
5ae1bf2
715da4b
8c79714
0ba1746
5fe7449
90748e3
01d6778
55d31da
8112224
305138e
1f2db85
93392a4
5bb617f
93aa66d
c40d99e
0030b16
44a513b
a7c7a3a
d408cd9
9ffe763
74a3ba7
9eb91af
d4f674a
e64b2a5
1c617e9
0aa76b0
d68c4e5
88bc18d
f1051f4
7c9bde3
a35cf4a
c17075f
0462528
09d8160
02028a1
7b346fa
862ce00
bd783bf
0a71922
e99e1b0
64c8656
0964f06
6bc8fa5
cdd7b01
ad4b429
d6c21b8
07d0e10
77fd927
2f53218
1e87138
ebb4493
a985492
9298f03
32e63d1
b59e796
751c997
fd79ee8
6eb3368
52d8e5f
eb61f9c
5d9f31d
c566c4d
ca52f74
86e1b2f
3cde02e
7117c42
d187237
c59debc
26bd114
15d4df3
916f7c5
caca9a3
28f09b2
2d2d84b
33a0d10
cae6038
bfe2a28
45f5c8b
3a7dbfe
b18e1e3
0a2ea99
98ad265
63f8f93
306c0c7
03e5e92
34f18e6
222f6cb
a0f6338
2443bc5
e4731ad
2c9348c
39a30ed
c4afb05
f05e744
d13a799
317840a
9a66d4e
3b9e651
a31362e
1102818
f38d90f
f4744cf
b8642de
ea1f7a7
ce3d517
cc43523
5caba85
a70a9c3
271e78d
4810c88
3bc522d
6eff1ce
50e30d5
7aa5874
6556e17
3a3374c
91a01b2
da55cca
a3a370d
7eed176
d94fd70
2be6b81
c754dd3
38c13cc
f765f71
3a62122
052c808
2fd28e4
11c7fc0
94bf29e
ee79edf
da0e23f
fef65b2
0c2a7ae
365d1b8
682c592
3f76b76
c427556
4f8c721
2d9a913
b856317
1a5c233
0300613
27a8adf
7765630
f5387d0
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 8MB default block size turned out to be a footgun for OpenChat that has thousands of canisters. The developers were not aware that stable-structures are allocating at least 8MB even if the actual usage is a few KB.
It might become an issue for Motoko canisters too. Ideally, the developer provides this number themselves such that they are aware of the implications. How difficult it is to make this a parameter that's configurable at runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Rust we do expose an API that allows users to change the region/bucket size from 8MiB to something else. It does bring additional complexity to developers though as they now need to understand that regions are pre-allocated with some minimum size, but maybe that's an unavoidable detail.
On a related note, I'm currently benchmarking smaller region sizes in the Rust implementation to better understand the performance trade-offs. I'll share those results once I have them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ulan and @ielashi
I liked how the 8MB minimum simplified some other decisions for the implementor, but I also wondered how to guide people to use these the right way without running up a budget of unused scratch space in their apps.
Since we are trying to "catch up" to the Rust stable memory manager at the moment, and not surpass its features, I'll stick with the current 8MB minimum for now. But I'm very curious to hear about the future test results that @ielashi may have about other options.
I'm also curious about a more layered approach, where initially-small regions can use a more fine-grained setting, and then use coarser blocks as they grow. That seems potentially too complex, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ulan asks
That's a good question. At "runtime" still means fixed at some point, right?
When would that parameter be given during the compilation and deployment phases, I wonder? Would it be a parameter to the actor, given when it's first installed?