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

TykTechnologies / tyk / 6740

Build:
DEFAULT BRANCH: master
Ran 31 May 2019 06:49PM UTC
Jobs 1
Files 111
Run time 10s
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

pending completion
6740

push

travis-ci

buger
basic auth cache - thundering heard (#2323)

resolves: https://github.com/TykTechnologies/tyk/issues/2324

Implemented singleflight, which suppresses/coalesces duplicate BCrypt function
calls for the same cache key in event of cache miss.

The purpose of Caching, is to avoid performing expensive computation if the computation has already been calculated.

But if the cache is empty (cold start, reload, expiry), and under high load, the first `x` requests will get a cache miss, and all simultaneously perform BCrypt + Caching of exactly the same password - then race to fill the cache.

So we have various problems under load… 

1. BCrypt is being called`x-1` too many times, 
2. Necessity to check & set in cache `x-1` too many times.

---

After receiving a cache-miss, we performs BCrypt + Cache via singleflight. Singleflight coalesces similar requests into a single call to BCrypt+Cache function, and returns the result to all of the remaining requests.

As such, when the cache is cleared (hot reload, cold-start, cache expire), we have mitigated the thundering herd problem, because only one of the herd will actually perform the expensive operation, while the others simply wait for the result.

11302 of 17732 relevant lines covered (63.74%)

0.71 hits per line

Jobs
ID Job ID Ran Files Coverage
2 6740.2 (LATEST_GO=true) 31 May 2019 06:49PM UTC 0
63.74
Travis Job 6740.2
Source Files on build 6740
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #6740
  • d61d2821 on github
  • Prev Build on master (#6738)
  • Next Build on master (#6741)
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