-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Multiple utilization samples in write load decider #132148
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
Changes from 4 commits
9f4a3c0
09f8bcb
0853c8e
356a349
b58df02
dcd2142
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,9 @@ | |
import org.elasticsearch.index.shard.ShardId; | ||
import org.elasticsearch.threadpool.ThreadPool; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
|
@@ -86,13 +88,17 @@ private static NodeUsageStatsForThreadPools.ThreadPoolUsageStats replaceWritePoo | |
) { | ||
final NodeUsageStatsForThreadPools.ThreadPoolUsageStats writeThreadPoolStats = value.threadPoolUsageStatsMap() | ||
.get(ThreadPool.Names.WRITE); | ||
return new NodeUsageStatsForThreadPools.ThreadPoolUsageStats( | ||
writeThreadPoolStats.totalThreadPoolThreads(), | ||
(float) Math.max( | ||
(writeThreadPoolStats.averageThreadPoolUtilization() + (writeLoadDelta / writeThreadPoolStats.totalThreadPoolThreads())), | ||
0.0 | ||
), | ||
writeThreadPoolStats.averageThreadPoolQueueLatencyMillis() | ||
final float newWritePoolUtilization = (float) Math.max( | ||
(writeThreadPoolStats.utilizationSamples().getLast().utilization() + (writeLoadDelta / writeThreadPoolStats.numberOfThreads())), | ||
0.0 | ||
); | ||
final List<NodeUsageStatsForThreadPools.UtilizationSample> newUtilizationSamples = new ArrayList<>( | ||
writeThreadPoolStats.utilizationSamples() | ||
); | ||
final NodeUsageStatsForThreadPools.UtilizationSample previousUtilization = newUtilizationSamples.removeLast(); | ||
newUtilizationSamples.add( | ||
new NodeUsageStatsForThreadPools.UtilizationSample(previousUtilization.instant(), newWritePoolUtilization) | ||
); | ||
return new NodeUsageStatsForThreadPools.ThreadPoolUsageStats(writeThreadPoolStats.numberOfThreads(), newUtilizationSamples); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Simulator will replace the most recent utilization value with the new one. We could instead add one to the end, but then what timestamp would we put on it? 🤷 Hard to know the best strategy without knowing how the determination of "hot spotting" is made, and whether we care about that in the simulator. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think hot-spot detection should be same for real data and simulation. How about simulate samples? Maybe apply fixed value to all of them and then run hot-spot detection? |
||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.
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.
There were
equals
,hashCode
andtoString
methods on these records, I'm not sure if they were once classes or we're doing something special here? I removed them in lieu of the ones you get for free with a record.