feat: Add an optional argument to set memory allocation#596
feat: Add an optional argument to set memory allocation#596
Conversation
| .long("memory-allocation") | ||
| .short("m") | ||
| .takes_value(true) | ||
| .default_value("8GB") |
There was a problem hiding this comment.
Do you want to duplicate the information about the default here? I think the two sensible design spaces are:
- The system defines a default,
dfxwill, if no--memory-allocationis passed, send none, system default applies - The system defines no default, the field is mandatory,
dfxdetermines (here) what the default is.
With this code, there are now two components both defining a default value; that’s odd.
There was a problem hiding this comment.
I'm fine with the first approach.
Btw, the same happens for compute allocation and I don't remember why it was done like that.
With this code, there are now two components both defining a default value; that’s odd.
No, there's two components that follow the default value set by a common reference (the public spec) :) But yeah it's probably redundant since the replica will enforce the default anyway.
There was a problem hiding this comment.
I wouldn’t consider it “following the public spec” if the client makes an optional field mandatory and hides the default value (which may change in later versions). But this is getting philosophical and we are in agreement :-)
Maybe the public spec shouldn’t be the place to define default values… oh well.
same happens for compute allocation
Yes, we should do the same for that too.
There was a problem hiding this comment.
Maybe the public spec shouldn’t be the place to define default values… oh well.
This would mean that a concrete Internet Computer implementation could choose an arbitrary (within the specified range) default value if none is specified, which would mean that if I use dfx against two different implementations of the IC, then I get different behavior for the same request. Maybe it's cool, maybe it's not.
Anyway, I already fell in your trap
But this is getting philosophical and we are in agreement :-)
and as I said I'm fine with your first suggestion.
There was a problem hiding this comment.
I'd much prefer the first approach.
No, there's two components that follow the default value set by a common reference (the public spec) :)
I think the mistake is treating it as a "default value" at the entry point. The spec just says if the value isn't specified the system should treat it like 2^33. That's at the instanciation point. Technically we could not have a field at all and still be spec compliant.
The interface definition is clear that the field is optional, so there should be nothing on the wire.
There was a problem hiding this comment.
Glad to see everyone in agreement :-)
nix/sources.json
Outdated
| }, | ||
| "dfinity": { | ||
| "ref": "v0.5.4", | ||
| "ref": "master", |
There was a problem hiding this comment.
Well, yes and no :)
I needed to point to a commit past v0.5.5 in dfinity to make things work for my demo last week. I'll use what I'm told here (presumably v0.5.6). Better yet, if someone bumps dfinity separately (say for a new SDK release) until this is merged and it includes the commit I'm interested in, I don't need to touch this at all.
There was a problem hiding this comment.
Great, muting the thread without approving. Just ping us if you do need a change that needs an infra review!
lsgunnlsgunn
left a comment
There was a problem hiding this comment.
Usage message looks reasonable.
|
This LGTM, but is blocked on NOT moving sources.json to master, which blocks the PR. As soon as Replica has a release with this change in, we can patch this PR and make it in. |
SGTM. Is there an expected date to get |
@hansl Looks like there's been a |
|
I should point out that if we want to be strict, the replica shoundn’t expose this feature until it has been part of a spec release (it’s not in 0.2), and therefore the SDK shouldn't be in it before. See https://github.com/dfinity-lab/ic-ref/issues/44 for the ongoing disucssion what goes into 0.4. Given the fuzz arond “focus on Tungston” it is not clear if memory allocation will make it. (Maybe the argument “it’s already almost there” will apply.) Whether we want to be strict in using the spec to plan an implement features is not my call to make. It unquestionably adds delays and some friction. |
The replica already supports this feature (for like a month now). Are you suggesting that I revert the change?
I assume you meant "focus on Tungsten". My understanding is that the memory allocation is something we want to be included for Tungsten and I am fairly certain that's @granstrom vision as well. Johan please correct me if I'm wrong.
The way I see it, if you can add a feature in a non-breaking way (memory allocation is such a case because there's a sensible default that is used even if SDK doesn't support it) then I don't see any problem looking ahead and implementing features that will be needed in general. But it's certainly not my call either how strict we want to be. |
|
Also perhaps we should move the discussion about including memory allocation or not on the issue you mentioned to avoid unnecessary noise in the current PR. |
Yes, absolute! Actually, the Google doc linked from that PR is the right place to discuss. I just wanted to increase visibility of that discussion |
|
A flag to set the memory allocation seems to be already available in latest dfx (checked against 0.6.10). Closing the current PR. |
## Changelog for advisory-db: Branch: master Commits: [rustsec/advisory-db@b08a98ac...89b9e106](rustsec/advisory-db@b08a98a...89b9e10) * [`6ea698b8`](rustsec/advisory-db@6ea698b) lazy-init: Missing Send bound for Lazy (khuey/lazy-init[RustSec/advisory-db#9](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/9)) * [`6703edaf`](rustsec/advisory-db@6703eda) apply review changes * [`47d589b0`](rustsec/advisory-db@47d589b) Assigned RUSTSEC-2021-0004 to lazy-init * [`efb79eff`](rustsec/advisory-db@efb79ef) report double drop issue in glsl-layout * [`47061ba3`](rustsec/advisory-db@47061ba) Report 0025-im to RustSec * [`4cf4c549`](rustsec/advisory-db@4cf4c54) Assigned RUSTSEC-2021-0005 to glsl-layout * [`b2a7af1c`](rustsec/advisory-db@b2a7af1) Assigned RUSTSEC-2020-0096 to im * [`1613b211`](rustsec/advisory-db@1613b21) Report 0063-xcb to RustSec * [`ea867420`](rustsec/advisory-db@ea86742) Assigned RUSTSEC-2020-0097 to xcb * [`d7de84ed`](rustsec/advisory-db@d7de84e) Add advisory for data race in rusb ([RustSec/advisory-db#580](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/580)) * [`3fbe0648`](rustsec/advisory-db@3fbe064) Assigned RUSTSEC-2020-0098 to rusb ([RustSec/advisory-db#581](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/581)) * [`c9886554`](rustsec/advisory-db@c988655) Add advisory for data race in aovec ([RustSec/advisory-db#528](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/528)) * [`315e464c`](rustsec/advisory-db@315e464) Assigned RUSTSEC-2020-0099 to aovec ([RustSec/advisory-db#596](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/596)) * [`97aa97b0`](rustsec/advisory-db@97aa97b) cache: exposes internally used raw pointer ([RustSec/advisory-db#543](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/543)) * [`89b9e106`](rustsec/advisory-db@89b9e10) Assigned RUSTSEC-2021-0006 to cache ([RustSec/advisory-db#598](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/598))
## Changelog for advisory-db: Branch: master Commits: [rustsec/advisory-db@b08a98ac...89b9e106](rustsec/advisory-db@b08a98a...89b9e10) * [`6ea698b8`](rustsec/advisory-db@6ea698b) lazy-init: Missing Send bound for Lazy (khuey/lazy-init[RustSec/advisory-db#9](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/9)) * [`6703edaf`](rustsec/advisory-db@6703eda) apply review changes * [`47d589b0`](rustsec/advisory-db@47d589b) Assigned RUSTSEC-2021-0004 to lazy-init * [`efb79eff`](rustsec/advisory-db@efb79ef) report double drop issue in glsl-layout * [`47061ba3`](rustsec/advisory-db@47061ba) Report 0025-im to RustSec * [`4cf4c549`](rustsec/advisory-db@4cf4c54) Assigned RUSTSEC-2021-0005 to glsl-layout * [`b2a7af1c`](rustsec/advisory-db@b2a7af1) Assigned RUSTSEC-2020-0096 to im * [`1613b211`](rustsec/advisory-db@1613b21) Report 0063-xcb to RustSec * [`ea867420`](rustsec/advisory-db@ea86742) Assigned RUSTSEC-2020-0097 to xcb * [`d7de84ed`](rustsec/advisory-db@d7de84e) Add advisory for data race in rusb ([RustSec/advisory-db#580](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/580)) * [`3fbe0648`](rustsec/advisory-db@3fbe064) Assigned RUSTSEC-2020-0098 to rusb ([RustSec/advisory-db#581](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/581)) * [`c9886554`](rustsec/advisory-db@c988655) Add advisory for data race in aovec ([RustSec/advisory-db#528](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/528)) * [`315e464c`](rustsec/advisory-db@315e464) Assigned RUSTSEC-2020-0099 to aovec ([RustSec/advisory-db#596](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/596)) * [`97aa97b0`](rustsec/advisory-db@97aa97b) cache: exposes internally used raw pointer ([RustSec/advisory-db#543](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/543)) * [`89b9e106`](rustsec/advisory-db@89b9e10) Assigned RUSTSEC-2021-0006 to cache ([RustSec/advisory-db#598](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/598))
This patch adds an optional parameter to
dfx canister installwhich allows the user to set a memory allocation for their canister.I've modeled this similarly to the param for compute allocation. Let me know what you think and also feel free to push commits on this branch if it's easier and faster.
I'm also not sure what kind of testing you'd expect for this. I've used this patch to present in the last global R&D, so it works (at least it did the job I wanted).