Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Add rate limiter configs for Presto plugin #75

Merged
merged 8 commits into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions go/tasks/plugins/presto/client/prestostatus_enumer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions go/tasks/plugins/presto/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ type RefreshCacheConfig struct {
LruCacheSize int `json:"lruCacheSize" pflag:",Size of the cache"`
}

type RateLimiterConfig struct {
Rate int64 `json:"rate" pflag:",Allowed rate of calls per second."`
Burst int `json:"burst" pflag:",Allowed burst rate of calls."`
lu4nm3 marked this conversation as resolved.
Show resolved Hide resolved
}

var (
defaultConfig = Config{
Environment: URLMustParse(""),
Expand All @@ -52,6 +57,10 @@ var (
Workers: 15,
LruCacheSize: 10000,
},
RateLimiterConfig: RateLimiterConfig{
Rate: 15,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will this be used for? Will it gate all calls to Mozart? Or just Presto? Will it be for only creation calls? Or both creation calls and all the status checking calls in the auto-refresh cache as well? Can you add some comments about how best to calculate a good number for this config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be used for all calls going to Mozart only for Presto. Sure I can add some comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In terms of the values themselves, I sort of took them from the awsbatch rate limiter. I'm sure we can adjust them later based on how the Presto cluster behaves

Burst: 20,
},
}

prestoConfigSection = pluginsConfig.MustRegisterSubSection(prestoConfigSectionKey, &defaultConfig)
Expand All @@ -64,6 +73,7 @@ type Config struct {
DefaultUser string `json:"defaultUser" pflag:",Default Presto user"`
RoutingGroupConfigs []RoutingGroupConfig `json:"routingGroupConfigs" pflag:"-,A list of cluster configs. Each of the configs corresponds to a service cluster"`
RefreshCacheConfig RefreshCacheConfig `json:"refreshCacheConfig" pflag:"Rate limiter config"`
RateLimiterConfig RateLimiterConfig `json:"rateLimiterConfig" pflag:"Rate limiter config"`
}

// Retrieves the current config value or default.
Expand Down