Convert properties in FIXED_PROPERTIES to be non-fixed
Changed these properties to be non-fixed (made no-fixed by creating a thread pool in the run method of Manager that "refresh" these properties on an interval):
-
MANAGER_TABLET_REFRESH_MINTHREADS -
MANAGER_TABLET_REFRESH_MAXTHREADS
Removed these non-fixed properties that were labeled as fixed:
-
MANAGER_MINTHREADS -
SSERV_MINTHREADS -
TSERV_MINTHREADS -
COMPACTOR_MINTHREADS
All of the other properties in FIXED_PROPERTIES besides these need to be evaluated similarly in another PR.
Partial work for #5696
Please take a look at ThreadPools.resizePool. We have some logic there that you can call from the refresh thread in the Manager. I'm not sure if fully covers what you are trying to here, but I know it partially does. Also, please use the Logger object instead of printing to System.out / System.err. We only do that in certain circumstances, like in utility code.
So would you recommend using the resizePool method, or just more so modeling the code based off of it?
So would you recommend using the resizePool method, or just more so modeling the code based off of it?
I would recommend reusing it if you can. If there is something that you need that it's not currently doing, then lets fix it or add a new resizePool method in ThreadPools.
I noticed that the resizePool() method resizes based on the maxThread property, and that when it's changed, the minThreads property is also changed to that new size in this code:
if (newCount > count) {
// increasing, increase the max first, or the core will fail to be increased
pool.setMaximumPoolSize(newCount);
pool.setCorePoolSize(newCount);
} else {
// decreasing, lower the core size first, or the max will fail to be lowered
pool.setCorePoolSize(newCount);
pool.setMaximumPoolSize(newCount);
}
Does that mean in the new resizePool() method I create for minThreads that when the CorePoolSize is changed, it would set the MaximumPoolSize to the same new value? I'm just a little confused on the relationship between the MaximumPoolSize and the CorePoolSize.
I noticed that the resizePool() method resizes based on the maxThread property, and that when it's changed, the minThreads property is also changed to that new size in this code:
Right, this was the logic that I was mentioning. IIRC we had to modify the core/max in a specific order based on the JDK internal code at that time. The current code just resizes based on the max size property IIRC because I don't think we resize based on the min/core size. You are trying to do something a little different than what we have done in the past, so you likely need a new method to resize the core and max independently, but might need to retain some of the logic from the existing resizePool method.
My internship is over, so I would need someone to pick up this ticket if more work needs to be done.