mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 08:23:34 +01:00
app/vmstorage: disable final merge by default, since it may result in high disk IO and CPU usage without measurable benefits such as increased query performance and reduced disk space usage
This commit is contained in:
parent
bd7cb4f5be
commit
d5a2b120e9
@ -31,9 +31,9 @@ var (
|
||||
forceMergeAuthKey = flag.String("forceMergeAuthKey", "", "authKey, which must be passed in query string to /internal/force_merge pages")
|
||||
forceFlushAuthKey = flag.String("forceFlushAuthKey", "", "authKey, which must be passed in query string to /internal/force_flush pages")
|
||||
|
||||
finalMergeDelay = flag.Duration("finalMergeDelay", 30*time.Second, "The delay before starting final merge for per-month partition after no new data is ingested into it. "+
|
||||
"Query speed and disk space usage is usually reduced after the final merge is complete. Too low delay for final merge may result in increased "+
|
||||
"disk IO usage and CPU usage")
|
||||
finalMergeDelay = flag.Duration("finalMergeDelay", 0, "The delay before starting final merge for per-month partition after no new data is ingested into it. "+
|
||||
"Final merge may require additional disk IO and CPU resources. Final merge may increase query speed and reduce disk space usage in some cases. "+
|
||||
"Zero value disables final merge")
|
||||
bigMergeConcurrency = flag.Int("bigMergeConcurrency", 0, "The maximum number of CPU cores to use for big merges. Default value is used if set to 0")
|
||||
smallMergeConcurrency = flag.Int("smallMergeConcurrency", 0, "The maximum number of CPU cores to use for small merges. Default value is used if set to 0")
|
||||
minScrapeInterval = flag.Duration("dedup.minScrapeInterval", 0, "Remove superflouos samples from time series if they are located closer to each other than this duration. "+
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
# tip
|
||||
|
||||
* FEATURE: disable final merge for data for the previous month at the beginning of new month, since it may result in high disk IO and CPU usage. Final merge can be enabled by setting `-finalMergeDelay` command-line flag to positive duration.
|
||||
|
||||
|
||||
# [v1.51.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.51.0)
|
||||
|
||||
|
@ -976,7 +976,7 @@ func (pt *partition) partsMerger(mergerFunc func(isFinal bool) error) error {
|
||||
if !errors.Is(err, errNothingToMerge) {
|
||||
return err
|
||||
}
|
||||
if fasttime.UnixTimestamp()-lastMergeTime > finalMergeDelaySeconds {
|
||||
if finalMergeDelaySeconds > 0 && fasttime.UnixTimestamp()-lastMergeTime > finalMergeDelaySeconds {
|
||||
// We have free time for merging into bigger parts.
|
||||
// This should improve select performance.
|
||||
lastMergeTime = fasttime.UnixTimestamp()
|
||||
@ -998,17 +998,18 @@ func (pt *partition) partsMerger(mergerFunc func(isFinal bool) error) error {
|
||||
}
|
||||
}
|
||||
|
||||
var finalMergeDelaySeconds = uint64(30)
|
||||
// Disable final merge by default, since it may lead to high disk IO and CPU usage
|
||||
// at the beginning of every month when merging data for the previous month.
|
||||
var finalMergeDelaySeconds = uint64(0)
|
||||
|
||||
// SetFinalMergeDelay sets the delay before doing final merge for partitions without newly ingested data.
|
||||
//
|
||||
// This function may be called only before Storage initialization.
|
||||
func SetFinalMergeDelay(delay time.Duration) {
|
||||
delaySeconds := int(delay.Seconds() + 0.5)
|
||||
if delaySeconds <= 0 {
|
||||
if delay <= 0 {
|
||||
return
|
||||
}
|
||||
finalMergeDelaySeconds = uint64(delaySeconds)
|
||||
finalMergeDelaySeconds = uint64(delay.Seconds() + 1)
|
||||
}
|
||||
|
||||
func maxRowsByPath(path string) uint64 {
|
||||
|
Loading…
Reference in New Issue
Block a user