• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uber / cadence / 018e43c7-e893-4c40-a63b-442d9dceb207
72%

Build:
DEFAULT BRANCH: master
Ran 15 Mar 2024 08:51PM UTC
Jobs 1
Files 670
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

15 Mar 2024 08:22PM UTC coverage: 64.882% (-0.01%) from 64.892%
018e43c7-e893-4c40-a63b-442d9dceb207

push

buildkite

web-flow
Global ratelimiter, part 1: core algorithm for computing weights (#5689)

A high level overview is covered in `common/quotas/global/doc.go`, and this specific piece is further covered in the `./algorithm/requestweighted.go` file.

At a very high level though, this is an isolated piece of a "deployment-wide load-balance-aware ratelimiter", intended to solve problems with our internal clusters with our current high-level frontend ratelimiters around client-triggered domain actions (start workflow, poll, etc).

This is the "logical core" of the whole system, with as few dependencies and concerns as I can manage.  All frontend hosts that will be imposing limits eventually send the update arguments to an aggregating host, and the aggregating host largely just delegates to a single instance of this algorithm.  Essentially all the aggregating host needs to do to respond is multiply the weight by each configured ratelimit (from dynamic config).

I've left the concurrency fairly coarse, both for simplicity and for computational speed. I don't believe this will be a bottleneck in even our largest cluster, but even if it is it should be fairly trivial to split each batch's ratelimit keys into N different sharded instances, which can be completely independent.

# The problem

All of our current ratelimiters currently fall into two conceptual buckets:
1. they enforce N rps on that in-memory instance
2. they enforce N rps on that in-memory instance _divided by the number of hosts in a ring_

While these are very straightforward and have served us well, they're proving inadequate in our internal clusters due to imbalanced load on our frontend instances.  Sometimes _wildly_ imbalanced, e.g. 10% of hosts receiving _all_ traffic for a domain.

What this leads to is a lower _effective_ ratelimit than is intended, e.g.:
- 100 rps is allowed
- 10 hosts exist (so each host allows 10 rps)
- 1 host receives 100 rps, the others receive 0
- the requests are... (continued)

191 of 191 new or added lines in 1 file covered. (100.0%)

102 existing lines in 20 files now uncovered.

94707 of 145968 relevant lines covered (64.88%)

2377.72 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
2
87.01
0.0% service/history/task/transfer_standby_task_executor.go
2
35.78
-0.28% client/history/client.go
2
49.59
-0.13% service/history/handler/handler.go
2
85.57
0.0% common/task/fifo_task_scheduler.go
2
73.68
-2.11% common/persistence/sql/sqlplugin/mysql/task.go
2
73.23
-1.57% service/matching/db.go
2
79.49
-2.56% common/persistence/sql/sqlplugin/mysql/db.go
3
50.18
-0.55% common/log/tag/tags.go
3
71.41
-0.47% common/persistence/nosql/nosqlplugin/cassandra/workflow.go
4
80.95
-2.12% common/archiver/filestore/historyArchiver.go
4
89.53
-2.09% service/history/task/redispatcher.go
4
76.09
-1.45% common/persistence/nosql/nosqlplugin/cassandra/tasks.go
4
85.05
-0.52% service/history/task/fetcher.go
5
84.08
-0.8% service/matching/taskReader.go
5
61.95
-1.68% common/persistence/nosql/nosql_task_store.go
6
62.05
-0.18% service/frontend/api/handler.go
9
68.3
-0.32% service/history/engine/engineimpl/historyEngine.go
9
62.02
-3.49% service/frontend/wrappers/metered/metered.go
12
20.93
-27.91% common/persistence/nosql/nosqlplugin/cassandra/gocql/public/client.go
20
79.13
-4.13% common/persistence/nosql/nosqlplugin/cassandra/workflow_parsing_utils.go
Jobs
ID Job ID Ran Files Coverage
1 018e43c7-e893-4c40-a63b-442d9dceb207.1 15 Mar 2024 08:51PM UTC 670
64.88
Source Files on build 018e43c7-e893-4c40-a63b-442d9dceb207
  • Tree
  • List 670
  • Changed 278
  • Source Changed 0
  • Coverage Changed 25
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 3091e416 on github
  • Prev Build on master (#018E436A...)
  • Next Build on master (#018E5285...)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc