-
Notifications
You must be signed in to change notification settings - Fork 457
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
adapter: Add resource limit for compute credits #18846
Conversation
Adds a resource limit for compute credits pre hour. Additionally, update the resource limit error messages. Resolves MaterializeInc#18830
b4d7239
to
481be85
Compare
@philip-stoev Feel free to delegate to someone else on the QA team. Also is there a better way to get the tests passing other than sprinkling a bunch of |
src/controller/src/clusters.rs
Outdated
/// The number of compute credits per hour. | ||
pub compute_credits_per_hour: f64, |
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.
It feels odd that this is a float (instead of e.g. an int representing 1000ths of a credit). I've traditionally been taught that anything accounting-related being a float is a code smell.
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.
What about Numeric
(i.e. Decimal<13>
), does that have the same code smell?
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.
AFAIK no
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 switched to Numeric
then. I think it's a bit more straight forward than converting back and forth between 1000ths of a credit.
Don't we need a cloud PR to add the new values to the size mappings? |
Yes, but I think the cloud team is going to do that, @chaas can you confirm? |
We should have an issue with the release-blocker tag for this to be added to cloud (per the PR checklist) |
Filed an issue in cloud https://github.com/MaterializeInc/cloud/issues/6216 |
…-compute-credits # Conflicts: # doc/user/content/sql/show.md
Co-authored-by: Nikhil Benesch <nikhil.benesch@gmail.com>
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.
LGTM modulo bikeshed about max_credits_per_hour
.
Maybe 64 was too low of a default. Should we set it to 1024 by default so you don't have to constantly adjust tests to bump the limit?
Thanks again for turning this around so quickly! |
Co-authored-by: Nikhil Benesch <nikhil.benesch@gmail.com>
Co-authored-by: Nikhil Benesch <nikhil.benesch@gmail.com>
Co-authored-by: Nikhil Benesch <nikhil.benesch@gmail.com>
This could hopefully be solved with a better description for the variable itself. @MaterializeInc/docs any thoughts? The current description is in |
I'm going to merge this once the cloud PR is merged. |
Sorry for the delay, @jkosh44.
This is hard to do well because it ties into how we charge, but I agree that
Also, is this really per region and not per account? |
The problem is that the unit is not "credits" but "credits per hour." I agree this is confusing! Here's how I think about it: this limit is equivalent to a driving speed limit. We call that a "speed limit" or a "maximum speed", but the limit is expressed in miles per hour. You might even say "max mph." But you wouldn't want to say "max miles", as that's would express a constraint on the maximum distance traveled, not the maximum rate at which distance is traveled (speed). Would |
The problem with |
|
Filing as a release blocker because this needs to make the release tomorrow. |
Here are the current proposals (plus two that I'm adding):
@benesch Do you want to just have the final say and pick one? We can always change it later since users never actually type in the field name. Also,
Can you confirm this? I'm pretty sure the answer is yes. |
Yes, confirmed. |
Well, I like what we currently have ( One more proposal to add: I say we give it until 11am tomorrow for @jseldess and/or @frankmcsherry to express an opinion. If we don't hear from them, then let's go with what you have. Does that timing work for you, @jkosh44? |
@benesch, I definitely don't want to block, but I I'm still having trouble understanding this. The credits per hour unit is for billing, correct? So if in a given hour I have 2 medium replicas (4 credits per hour each), for the full hour or any portion of it, we bill for 8 credits? Assuming that's how it works, and it's probably not, this internal limit isn't using the unit the same way. Here, it's not for billing per hour but for limiting the number of resources we allow at any given point in time. Am I way off? |
So, we bill by the second. Say you have those 2 medium replicas for 3 minutes each. We'll bill you for 2 replicas * 4 credits/hour/replica * 3 minutes * 1/60 hours/minute = 0.4 credits. The limit restricts the maximum instantaneous credit consumption rate. So if |
I am increasingly thinking that |
Yep, that gives me 3 hours before the 2pm deadline which should be plenty. |
oh, I did not realize this column exists -- it does not seem to be exercised by the test suite. Apart from that, the query is reasonable, (except that it also counts the internal clusters, which the limit enforcement does not) so I think no further changes to |
I suspected this PR will have a merge skew conflict with a test-fixing PR that operated in the same area, so I kicked the merge skew checker and indeed it is now red : https://buildkite.com/materialize/tests/builds/54145#0187a3fd-4a99-42bc-b3a2-7e8550a99006 |
Sorry to be so down to the wire here. I think it's hard to find a name that fully captures the meaning here, but I like
Lots that still needs to be unpacked, but probably not (just) in this variable description. |
Ok, it's 11AM. I went with the name |
Adds a resource limit for compute credits pre hour. Additionally, update the resource limit error messages.
Resolves #18830
Motivation
This PR adds a known-desirable feature.
Checklist
$T ⇔ Proto$T
mapping (possibly in a backwards-incompatible way) and therefore is tagged with aT-proto
label.