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
AdaptiveServerSelection: Fix timer #9697
Conversation
b8031f8
to
e727fa5
Compare
@dmyang please review. |
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.
Left a comment on sharing the same executor service. Changes look good to me otherwise. Thanks for addressing this!
private ExecutorService _executorService; | ||
|
||
// ScheduledExecutorServer for processing periodic tasks like decay. | ||
private ScheduledExecutorService _periodicTaskExecutor; |
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.
Could the periodic tasks share the same executor service by changing the main executor service to a scheduled one? That way the threadpool size can still be modified w/ pinot config
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.
The reasoning for not using the same executorService is as follows: The main executor service is responsible for collecting stats about servers. The number of periodic tasks is proportional to the number of servers. And we wouldn't want it to interfere with stats collection - which is critical for making the routing decision.
However, we can have a separate config to control the number of periodic task threads. But I do not see us needing more than 1 thread for this purpose. Let's say, autoDecay window is 30seconds. With 200 severs, we would be generating 2*200 = 400 periodic tasks every 30 seconds. A single thread should be sufficient to process these tasks.
I've also DM'ed you on the Apache Pinot slack channel.
Thoughts?
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 for explaining reasoning. That makes sense to me and seems fine to leave as is.
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.
If needed, we can add the config for number of threads in a separate PR
Label = BugFix
ExponentialWeightedMovingAverage
class currently uses aTimer
to periodically autoDecay the value if there are no updates. We maintain stats for each Server. So if there number of servers are too many, the number JVM threads could blow up.In this PR we create a ScheduledThreadPoolExecutor with just a single thread. This thread is responsible for processing all the periodic tasks.