github.com/weaviate/weaviate@v1.24.6/entities/cyclemanager/interval.go (about) 1 // _ _ 2 // __ _____ __ ___ ___ __ _| |_ ___ 3 // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ 4 // \ V V / __/ (_| |\ V /| | (_| | || __/ 5 // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| 6 // 7 // Copyright © 2016 - 2024 Weaviate B.V. All rights reserved. 8 // 9 // CONTACT: hello@weaviate.io 10 // 11 12 package cyclemanager 13 14 import "time" 15 16 const ( 17 compactionMinInterval = 3 * time.Second 18 compactionMaxInterval = time.Minute 19 compactionBase = uint(2) 20 compactionSteps = uint(4) 21 ) 22 23 // 3s . 6.8s .. 14.4s .... 29.6s ........ 60s 24 func CompactionCycleIntervals() CycleIntervals { 25 return NewExpIntervals(compactionMinInterval, compactionMaxInterval, 26 compactionBase, compactionSteps) 27 } 28 29 // run cycle ticker with fixed minimal interval and let each shard 30 // take care of its intervals 31 func CompactionCycleTicker() CycleTicker { 32 return NewFixedTicker(compactionMinInterval) 33 } 34 35 const ( 36 memtableFlushMinInterval = 100 * time.Millisecond 37 memtableFlushMaxInterval = 5 * time.Second 38 memtableFlushBase = uint(2) 39 memtableFlushSteps = uint(5) 40 ) 41 42 // 100ms . 258ms .. 574ms .... 1.206s ........ 2.471s ................ 5s 43 func MemtableFlushCycleIntervals() CycleIntervals { 44 return NewExpIntervals(memtableFlushMinInterval, memtableFlushMaxInterval, 45 memtableFlushBase, memtableFlushSteps) 46 } 47 48 // run cycle ticker with fixed minimal interval and let each shard 49 // take care of its intervals 50 func MemtableFlushCycleTicker() CycleTicker { 51 return NewFixedTicker(memtableFlushMinInterval) 52 } 53 54 const ( 55 geoCommitLoggerMinInterval = 10 * time.Second 56 geoCommitLoggerMaxInterval = 60 * time.Second 57 geoCommitLoggerBase = uint(2) 58 geoCommitLoggerSteps = uint(4) 59 ) 60 61 // 10s . 13.3s .. 20s .... 33.3s ........ 60s 62 func GeoCommitLoggerCycleIntervals() CycleIntervals { 63 return NewExpIntervals(geoCommitLoggerMinInterval, geoCommitLoggerMaxInterval, 64 geoCommitLoggerBase, geoCommitLoggerSteps) 65 } 66 67 // run cycle ticker with fixed minimal interval and let each shard 68 // take care of its intervals 69 func GeoCommitLoggerCycleTicker() CycleTicker { 70 return NewFixedTicker(geoCommitLoggerMinInterval) 71 } 72 73 const ( 74 hnswCommitLoggerMinInterval = 500 * time.Millisecond 75 hnswCommitLoggerMaxInterval = 10 * time.Second 76 hnswCommitLoggerBase = uint(2) 77 hnswCommitLoggerSteps = uint(5) 78 ) 79 80 // 500ms . 806ms .. 1.42s .... 2.65s ........ 5.1s ................10s 81 func HnswCommitLoggerCycleIntervals() CycleIntervals { 82 return NewExpIntervals(hnswCommitLoggerMinInterval, hnswCommitLoggerMaxInterval, 83 hnswCommitLoggerBase, hnswCommitLoggerSteps) 84 } 85 86 // run cycle ticker with fixed minimal interval and let each shard 87 // take care of its intervals 88 func HnswCommitLoggerCycleTicker() CycleTicker { 89 return NewFixedTicker(hnswCommitLoggerMinInterval) 90 }