-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: load balance test location in WPT (DELO-4766) #95
feat: load balance test location in WPT (DELO-4766) #95
Conversation
- introduced locations update timeout
wtp/apiCaller.js
Outdated
fvonly: 1, // first view only | ||
timeline: 1 // workaround for WPT sometimes hanging on getComputedStyle() | ||
}, | ||
headers: { 'User-Agent': 'WebSpeedTest', 'X-WPT-API-KEY': apiKey }, | ||
headers: { 'User-Agent': 'WebSpeedTest', 'X-WPT-API-KEY': apiKeys.get() }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe to keep the semantics of key
we could rename get
to getRandom()
or getKey()
if random is just an implementation detail..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, corrected as per suggestion
This feature introduces load-balancing across multiple WPT locations. The goal is to always choose least loaded region.
Please note that US-based regions are taken into consideration only.
The following configuration options are introduced:
WTP_LS_CACHE_TTL
(defaults:10
sec) - how long to cache locations and selected location;0
means we check best location on every test runWTP_LS_DEFAULT_LOCATION
(defaults:IAD_US_01
- which location to use in case there is a problem with API and there is nothing selected yetWTP_LS_UPDATE_TIMEOUT
- (defaults:20
sec) timeout for updating locationsAlso, for better insight there are two new endpoints (both responses served from local cache):
/locations
- prints out all locations we consider along with their metrics/locations/current
- identifier of the location we currently use as the best one