Commit ed9d1e66 authored by Jacob Vosmaer (GitLab)'s avatar Jacob Vosmaer (GitLab)

Merge branch 'rate-limit-builds-register' into 'master'

Rate limit builds register

Previously we were rate-limiting `/api` and `/ci/api`. This makes the it more targeted to only limit the capacity given to `builds/register.json` as this seems to be a main culprit of our stability problems.

@jacobvosmaer-gitlab @stanhu @pcarranza What do you think?

See merge request !95
parents eb451e03 e6c8334d
...@@ -56,7 +56,7 @@ func (u *Upstream) configureRoutes() { ...@@ -56,7 +56,7 @@ func (u *Upstream) configureRoutes() {
git.SendPatch, git.SendPatch,
artifacts.SendEntry, artifacts.SendEntry,
) )
apiProxyQueue := queueing.QueueRequests(proxy, u.APILimit, u.APIQueueLimit, u.APIQueueTimeout) ciAPIProxyQueue := queueing.QueueRequests(proxy, u.APILimit, u.APIQueueLimit, u.APIQueueTimeout)
u.Routes = []route{ u.Routes = []route{
// Git Clone // Git Clone
...@@ -68,9 +68,12 @@ func (u *Upstream) configureRoutes() { ...@@ -68,9 +68,12 @@ func (u *Upstream) configureRoutes() {
// CI Artifacts // CI Artifacts
route{"POST", regexp.MustCompile(ciAPIPattern + `v1/builds/[0-9]+/artifacts\z`), contentEncodingHandler(artifacts.UploadArtifacts(api, proxy))}, route{"POST", regexp.MustCompile(ciAPIPattern + `v1/builds/[0-9]+/artifacts\z`), contentEncodingHandler(artifacts.UploadArtifacts(api, proxy))},
// Limit capacity given to builds/register.json
route{"", regexp.MustCompile(ciAPIPattern + `v1/builds/register.json\z`), ciAPIProxyQueue},
// Explicitly proxy API requests // Explicitly proxy API requests
route{"", regexp.MustCompile(apiPattern), apiProxyQueue}, route{"", regexp.MustCompile(apiPattern), proxy},
route{"", regexp.MustCompile(ciAPIPattern), apiProxyQueue}, route{"", regexp.MustCompile(ciAPIPattern), proxy},
// Serve assets // Serve assets
route{"", regexp.MustCompile(`^/assets/`), route{"", regexp.MustCompile(`^/assets/`),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment