Skip to content

Commit

Permalink
Merge pull request #31203 from vespa-engine/jonmv/less-aggressive-smo…
Browse files Browse the repository at this point in the history
…othing

Less aggressive smoothing, and readjust a bit less often
  • Loading branch information
baldersheim authored May 14, 2024
2 parents cf84c1d + 34a1fe4 commit 63c765e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions client/go/internal/vespa/document/throttler.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func NewThrottler(connections int) Throttler { return newThrottler(connections,
func (t *dynamicThrottler) Sent() {
currentInflight := t.TargetInflight()
t.sent++
if t.sent*t.sent*t.sent < 100*currentInflight*currentInflight {
if t.sent*t.sent*t.sent < 1000*currentInflight*currentInflight {
return
}
t.sent = 0
Expand Down Expand Up @@ -94,7 +94,7 @@ func (t *dynamicThrottler) Sent() {
if j != -1 {
u := t.throughputs[j]
if k != -1 {
t.throughputs[j] = (2*u + t.throughputs[i] + s) / 4
t.throughputs[j] = (18*u + t.throughputs[i] + s) / 20
}
s = u
}
Expand Down
2 changes: 1 addition & 1 deletion client/go/internal/vespa/document/throttler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestThrottler(t *testing.T) {
if got, want := tr.TargetInflight(), int64(16); got != want {
t.Errorf("got TargetInflight() = %d, but want %d", got, want)
}
for i := 0; i < 30; i++ {
for i := 0; i < 65; i++ {
tr.Sent()
tr.Success()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public DynamicThrottler(FeedClientBuilderImpl builder) {
@Override
public void sent(long __, CompletableFuture<HttpResponse> ___) {
double currentInflight = targetInflight();
if (++sent * sent * sent < 1e2 * currentInflight * currentInflight)
if (++sent * sent * sent < 1e3 * currentInflight * currentInflight)
return;

sent = 0;
Expand Down Expand Up @@ -63,7 +63,7 @@ public void sent(long __, CompletableFuture<HttpResponse> ___) {
// Additionally, smooth the throughput values, to reduce the impact of noise, and reduce jumpiness.
if (j != -1) {
double t = throughputs[j];
if (k != -1) throughputs[j] = (2 * t + throughputs[i] + s) / 4;
if (k != -1) throughputs[j] = (18 * t + throughputs[i] + s) / 20;
s = t;
}
k = j;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void testThrottler() {
DynamicThrottler throttler = new DynamicThrottler(new FeedClientBuilderImpl(List.of(URI.create("http://localhost:8080"))));
assertEquals(16, throttler.targetInflight());

for (int i = 0; i < 30; i++) {
for (int i = 0; i < 65; i++) {
throttler.sent(1, null);
throttler.success();
}
Expand Down

0 comments on commit 63c765e

Please sign in to comment.