-
Notifications
You must be signed in to change notification settings - Fork 671
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
[BUG] webApi readRateLimiter settings are not respected #5202
Comments
Thank you for providing detailed information about the issue you're facing. It seems like the From your description, it appears that the rate limiting logic might not be correctly implemented in the Databricks plugin's HTTP request handling. Specifically, the To address this issue, you could consider integrating a rate limiter directly into the
import (
"golang.org/x/time/rate"
// other imports
)
type Plugin struct {
metricScope promutils.Scope
cfg *Config
client HTTPClient
readRateLimiter *rate.Limiter // Add this line
}
func newDatabricksJobTaskPlugin() webapi.PluginEntry {
return webapi.PluginEntry{
ID: "databricks",
SupportedTaskTypes: []core.TaskType{"spark"},
PluginLoader: func(ctx context.Context, iCtx webapi.PluginSetupContext) (webapi.AsyncPlugin, error) {
cfg := GetConfig()
// Assuming cfg.ReadQPS and cfg.ReadBurst are the configured QPS and burst values.
readRateLimiter := rate.NewLimiter(rate.Limit(cfg.ReadQPS), cfg.ReadBurst)
return &Plugin{
metricScope: iCtx.MetricsScope(),
cfg: cfg,
client: &http.Client{},
readRateLimiter: readRateLimiter, // Initialize the rate limiter here
}, nil
},
}
}
Before making the HTTP request in the func (p Plugin) sendRequest(method string, databricksJob map[string]interface{}, token string, runID string) (map[string]interface{}, error) {
// Wait for permission from the rate limiter
err := p.readRateLimiter.Wait(context.Background())
if err != nil {
return nil, fmt.Errorf("rate limiter error: %v", err)
}
// Existing implementation of sendRequest continues here...
} By integrating a rate limiter as shown above, you can control the rate of HTTP requests made to the Databricks API, ensuring that the Please note that this is a suggested solution based on the information provided and the current state of the Flyte codebase. It's always a good idea to thoroughly test any changes in a controlled environment before deploying them to production. If you have any further questions or need additional assistance, feel free to ask. Sources
|
Describe the bug
We are using Flyte with Databricks plugin (GO) with the following config:
Databricks API uses a very low API rate limit for job polling (100), Flyte tasks often run into HTTP 429 - Too Many Requests response.
We did some code analysis and found that Flyte triggers the calls to DBX, ignoring the readRateLimiter settings.
We identified a potentional root cause (workqueue.DefaultControllerRateLimiter() was used in cache.go), @kumare3 created a fix in #5190
We have tested the fix, unfortunately it did not resolve the issue.
Expected behavior
Job polling request rate never exceeds the preconfigured burst value (20).
Additional context to reproduce
No response
Screenshots
Are you sure this issue hasn't been raised already?
Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: