-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Implement CPU and Memory runtime controls #8251
Conversation
cpus: $function->getAttribute('cpus', 1), | ||
memory: $function->getAttribute('memory', 128), |
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.
Execution specs and build specs should remain different. We should either hard-code build specs (very high), or make it configurable separatelly.
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.
I hard-coded 2 cpu cores and 1024 memory, that should be enough right?
->addRule('memory', [ | ||
'type' => self::TYPE_INTEGER, | ||
'description' => 'Function execution memory limit in MB.', | ||
'default' => 512, | ||
'example' => 1024, | ||
]) | ||
->addRule('cpus', [ | ||
'type' => self::TYPE_INTEGER, |
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.
Let's confirm with team lead.. Should this be integer, or string? If it's integer I would expect slider on Console. If it was string, I would expect select dropdown.
Same for developers using API, integer indicates I might be able to set it to anything. Using ENUM here might work better
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.
Enum will probably make more sense here, will update appropriately
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.
Can we add enums to models? I can't seem to see a self::TYPE_ENUM
in the Model class
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.
Not sure, if we never did it, we can do STRING. Check what we did for plan
in billing, I think that behaves as enum
'cpus' => $this->cpus, | ||
'memory' => $this->memory, |
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.
We can remove those $this variables, they shouldn' be needed anymore
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.
Alright, done
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.
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.
Whoops, my bad. Fixing now
@Meldiron I think we should change the values in the .env to be 2 cores and 1024 memory so we can test changing it. Otherwise we won't be able to. Appwrite's listed minimum specs is 2 cpu cores and 4GB of memory so we should be fine here |
Co-authored-by: Matej Bačo <[email protected]>
…ppwrite into feat-runtime-controls
Closing this to retarget it to 1.5.x |
What does this PR do?
This PR implements CPU and Memory controls for Runtimes, adding new
cpus
andmemory
attributes onto the functions document and it's relevant API endpoints._APP_FUNCTIONS_CPUS
and_APP_FUNCTIONS_MEMORY
are now utilised as the max amount of memory and CPUs that can be allocated to a function.To be implemented
_APP_FUNCTIONS_CPUS
and_APP_FUNCTIONS_MEMORY
as limiters and to reflect that in the APITest Plan
Related PRs and Issues
Checklist