Skip to content

Commit 05a306c

Browse files
craig[bot]andy-kimball
andcommitted
Merge #150574
150574: tenantcostserver: give default tokens for testing r=stevendanna a=andy-kimball Previously, the tenant token bucket server defaulted to 10K tokens/second. This rate is used by tests (in production, it is configured via calls to update_tenant_resource_limits). However, while the default grant included the 10K rate, it did not include any up-front tokens. This was causing some tests to be throttled. The fix is to grant 10 seconds worth of tokens up-front by setting TokenCurrent = 10 * the default 10K rate. Epic: none Release note: None Co-authored-by: Andrew Kimball <[email protected]>
2 parents 944facb + 835e0df commit 05a306c

File tree

7 files changed

+35
-16
lines changed

7 files changed

+35
-16
lines changed

pkg/ccl/multitenantccl/tenantcostserver/system_table.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ func (ts *tenantState) update(now time.Time) {
6767
FirstInstance: 0,
6868
Bucket: tenanttokenbucket.State{
6969
TokenRefillRate: defaultRefillRate,
70+
TokenCurrent: 10 * defaultRefillRate,
7071
},
7172
}
7273
return

pkg/ccl/multitenantccl/tenantcostserver/testdata/cleanup

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
create-tenant tenant=5
22
----
33

4+
configure tenant=5
5+
available_tokens: 0
6+
refill_rate: 10000
7+
max_burst_tokens: 0
8+
----
9+
410

511
# First, establish a few instances.
612
token-bucket-request tenant=5
@@ -34,6 +40,12 @@ First active instance: 3
3440
create-tenant tenant=13
3541
----
3642

43+
configure tenant=13
44+
available_tokens: 0
45+
refill_rate: 10000
46+
max_burst_tokens: 0
47+
----
48+
3749
token-bucket-request tenant=13
3850
instance_id: 2
3951
----

pkg/ccl/multitenantccl/tenantcostserver/testdata/instances

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ instance_id: 10
1717

1818
inspect tenant=5
1919
----
20-
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=0 token-current-avg=0
20+
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=100000 token-current-avg=25000
2121
Consumption: ru=0 kvru=0 reads=0 in 0 batches (0 bytes) writes=0 in 0 batches (0 bytes) pod-cpu-usage: 0 secs pgwire-egress=0 bytes external-egress=0 bytes external-ingress=0 bytes estimated-cpu: 0 secs
2222
Rates: write-batches=0,0 estimated-cpu=0,0
2323
Last update: 00:00:00.000
@@ -30,7 +30,7 @@ instance_id: 10
3030

3131
inspect tenant=5
3232
----
33-
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=0 token-current-avg=0
33+
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=100000 token-current-avg=43750
3434
Consumption: ru=0 kvru=0 reads=0 in 0 batches (0 bytes) writes=0 in 0 batches (0 bytes) pod-cpu-usage: 0 secs pgwire-egress=0 bytes external-egress=0 bytes external-ingress=0 bytes estimated-cpu: 0 secs
3535
Rates: write-batches=0,0 estimated-cpu=0,0
3636
Last update: 00:00:00.000
@@ -43,7 +43,7 @@ instance_id: 20
4343

4444
inspect tenant=5
4545
----
46-
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=0 token-current-avg=0
46+
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=100000 token-current-avg=57812.5
4747
Consumption: ru=0 kvru=0 reads=0 in 0 batches (0 bytes) writes=0 in 0 batches (0 bytes) pod-cpu-usage: 0 secs pgwire-egress=0 bytes external-egress=0 bytes external-ingress=0 bytes estimated-cpu: 0 secs
4848
Rates: write-batches=0,0 estimated-cpu=0,0
4949
Last update: 00:00:00.000
@@ -57,7 +57,7 @@ instance_id: 15
5757

5858
inspect tenant=5
5959
----
60-
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=0 token-current-avg=0
60+
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=100000 token-current-avg=68359.375
6161
Consumption: ru=0 kvru=0 reads=0 in 0 batches (0 bytes) writes=0 in 0 batches (0 bytes) pod-cpu-usage: 0 secs pgwire-egress=0 bytes external-egress=0 bytes external-ingress=0 bytes estimated-cpu: 0 secs
6262
Rates: write-batches=0,0 estimated-cpu=0,0
6363
Last update: 00:00:00.000
@@ -72,7 +72,7 @@ instance_id: 1
7272

7373
inspect tenant=5
7474
----
75-
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=0 token-current-avg=0
75+
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=100000 token-current-avg=76269.53125
7676
Consumption: ru=0 kvru=0 reads=0 in 0 batches (0 bytes) writes=0 in 0 batches (0 bytes) pod-cpu-usage: 0 secs pgwire-egress=0 bytes external-egress=0 bytes external-ingress=0 bytes estimated-cpu: 0 secs
7777
Rates: write-batches=0,0 estimated-cpu=0,0
7878
Last update: 00:00:00.000

pkg/ccl/multitenantccl/tenantcostserver/testdata/metrics

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ consumption:
7171

7272
inspect tenant=5
7373
----
74-
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=0 token-current-avg=0
74+
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=100000 token-current-avg=57812.5
7575
Consumption: ru=1110 kvru=888 reads=2220 in 222 batches (3330 bytes) writes=4440 in 333 batches (5550 bytes) pod-cpu-usage: 6660 secs pgwire-egress=7770 bytes external-egress=0 bytes external-ingress=0 bytes estimated-cpu: 9990 secs
7676
Rates: write-batches=0,33.3 estimated-cpu=0,999
7777
Last update: 00:00:00.000

pkg/ccl/multitenantccl/tenantcostserver/testdata/rates

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ consumption:
2222

2323
inspect tenant=5
2424
----
25-
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=0 token-current-avg=0
25+
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=100000 token-current-avg=25000
2626
Consumption: ru=10 kvru=10 reads=20 in 1 batches (30 bytes) writes=40 in 10 batches (50 bytes) pod-cpu-usage: 60 secs pgwire-egress=70 bytes external-egress=0 bytes external-ingress=0 bytes estimated-cpu: 80 secs
2727
Rates: write-batches=0,1 estimated-cpu=0,8
2828
Last update: 00:00:00.000
@@ -53,7 +53,7 @@ consumption:
5353

5454
inspect tenant=5
5555
----
56-
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=50000 token-current-avg=12500
56+
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=150000 token-current-avg=56250
5757
Consumption: ru=20 kvru=20 reads=40 in 2 batches (60 bytes) writes=80 in 20 batches (100 bytes) pod-cpu-usage: 120 secs pgwire-egress=140 bytes external-egress=0 bytes external-ingress=0 bytes estimated-cpu: 160 secs
5858
Rates: write-batches=0,2 estimated-cpu=0,16
5959
Last update: 00:00:05.000
@@ -84,7 +84,7 @@ consumption:
8484

8585
inspect tenant=5
8686
----
87-
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=100000 token-current-avg=34375
87+
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=200000 token-current-avg=92187.5
8888
Consumption: ru=30 kvru=30 reads=60 in 3 batches (90 bytes) writes=120 in 30 batches (150 bytes) pod-cpu-usage: 180 secs pgwire-egress=210 bytes external-egress=0 bytes external-ingress=0 bytes estimated-cpu: 240 secs
8989
Rates: write-batches=2,1 estimated-cpu=16,8
9090
Last update: 00:00:10.000
@@ -116,7 +116,7 @@ consumption_period: 40s
116116

117117
inspect tenant=5
118118
----
119-
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=500000 token-current-avg=150781.25
119+
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=600000 token-current-avg=219140.625
120120
Consumption: ru=40 kvru=40 reads=80 in 4 batches (120 bytes) writes=160 in 50 batches (200 bytes) pod-cpu-usage: 240 secs pgwire-egress=280 bytes external-egress=0 bytes external-ingress=0 bytes estimated-cpu: 320 secs
121121
Rates: write-batches=0.5,0.5 estimated-cpu=2,2
122122
Last update: 00:00:50.000

pkg/ccl/multitenantccl/tenantcostserver/testdata/requests

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
create-tenant tenant=5
66
----
77

8+
configure tenant=5
9+
available_tokens: 0
10+
refill_rate: 10000
11+
max_burst_tokens: 0
12+
----
13+
814
token-bucket-request tenant=5
915
instance_id: 1
1016
tokens: 10

pkg/ccl/multitenantccl/tenantcostserver/testdata/seqnum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ consumption:
2121

2222
inspect tenant=5
2323
----
24-
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=0 token-current-avg=0
24+
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=100000 token-current-avg=25000
2525
Consumption: ru=10 kvru=10 reads=20 in 1 batches (30 bytes) writes=40 in 3 batches (50 bytes) pod-cpu-usage: 60 secs pgwire-egress=70 bytes external-egress=0 bytes external-ingress=0 bytes estimated-cpu: 80 secs
2626
Rates: write-batches=0,0.3 estimated-cpu=0,8
2727
Last update: 00:00:00.000
@@ -49,7 +49,7 @@ consumption:
4949

5050
inspect tenant=5
5151
----
52-
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=0 token-current-avg=0
52+
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=100000 token-current-avg=43750
5353
Consumption: ru=20 kvru=20 reads=40 in 2 batches (60 bytes) writes=80 in 6 batches (100 bytes) pod-cpu-usage: 120 secs pgwire-egress=140 bytes external-egress=0 bytes external-ingress=0 bytes estimated-cpu: 160 secs
5454
Rates: write-batches=0,0.6 estimated-cpu=0,16
5555
Last update: 00:00:00.000
@@ -77,7 +77,7 @@ consumption:
7777

7878
inspect tenant=5
7979
----
80-
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=0 token-current-avg=0
80+
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=100000 token-current-avg=57812.5
8181
Consumption: ru=20 kvru=20 reads=40 in 2 batches (60 bytes) writes=80 in 6 batches (100 bytes) pod-cpu-usage: 120 secs pgwire-egress=140 bytes external-egress=0 bytes external-ingress=0 bytes estimated-cpu: 160 secs
8282
Rates: write-batches=0,0.6 estimated-cpu=0,16
8383
Last update: 00:00:00.000
@@ -104,7 +104,7 @@ consumption:
104104

105105
inspect tenant=5
106106
----
107-
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=0 token-current-avg=0
107+
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=100000 token-current-avg=68359.375
108108
Consumption: ru=20 kvru=20 reads=40 in 2 batches (60 bytes) writes=80 in 6 batches (100 bytes) pod-cpu-usage: 120 secs pgwire-egress=140 bytes external-egress=0 bytes external-ingress=0 bytes estimated-cpu: 160 secs
109109
Rates: write-batches=0,0.6 estimated-cpu=0,16
110110
Last update: 00:00:00.000
@@ -132,7 +132,7 @@ consumption:
132132

133133
inspect tenant=5
134134
----
135-
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=0 token-current-avg=0
135+
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=100000 token-current-avg=76269.53125
136136
Consumption: ru=30 kvru=40 reads=60 in 3 batches (90 bytes) writes=120 in 9 batches (150 bytes) pod-cpu-usage: 180 secs pgwire-egress=210 bytes external-egress=0 bytes external-ingress=0 bytes estimated-cpu: 240 secs
137137
Rates: write-batches=0,0.9 estimated-cpu=0,24
138138
Last update: 00:00:00.000
@@ -160,7 +160,7 @@ consumption:
160160

161161
inspect tenant=5
162162
----
163-
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=0 token-current-avg=0
163+
Bucket state: token-burst-limit=0 token-refill-rate=10000 token-current=100000 token-current-avg=82202.1484375
164164
Consumption: ru=40 kvru=70 reads=80 in 4 batches (120 bytes) writes=160 in 12 batches (200 bytes) pod-cpu-usage: 240 secs pgwire-egress=280 bytes external-egress=0 bytes external-ingress=0 bytes estimated-cpu: 320 secs
165165
Rates: write-batches=0,1.2 estimated-cpu=0,32
166166
Last update: 00:00:00.000

0 commit comments

Comments
 (0)