mirror of
https://github.com/minio/minio.git
synced 2024-12-25 14:45:54 -05:00
add more bootstrap messages to provide latency (#17650)
- simplify refreshing bucket metadata, wait() to depend on how fast the bucket metadata can load. - simplify resync to start resync in single pass.
This commit is contained in:
parent
bdddf597f6
commit
005a4a275a
@ -21,7 +21,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -489,6 +488,8 @@ func (sys *BucketMetadataSys) concurrentLoad(ctx context.Context, buckets []Buck
|
|||||||
func (sys *BucketMetadataSys) refreshBucketsMetadataLoop(ctx context.Context) {
|
func (sys *BucketMetadataSys) refreshBucketsMetadataLoop(ctx context.Context) {
|
||||||
const bucketMetadataRefresh = 15 * time.Minute
|
const bucketMetadataRefresh = 15 * time.Minute
|
||||||
|
|
||||||
|
sleeper := newDynamicSleeper(2, 150*time.Millisecond, false)
|
||||||
|
|
||||||
t := time.NewTimer(bucketMetadataRefresh)
|
t := time.NewTimer(bucketMetadataRefresh)
|
||||||
defer t.Stop()
|
defer t.Stop()
|
||||||
for {
|
for {
|
||||||
@ -512,13 +513,16 @@ func (sys *BucketMetadataSys) refreshBucketsMetadataLoop(ctx context.Context) {
|
|||||||
sys.RemoveStaleBuckets(diskBuckets)
|
sys.RemoveStaleBuckets(diskBuckets)
|
||||||
|
|
||||||
for _, bucket := range buckets {
|
for _, bucket := range buckets {
|
||||||
|
wait := sleeper.Timer(ctx)
|
||||||
|
|
||||||
err := sys.loadBucketMetadata(ctx, bucket)
|
err := sys.loadBucketMetadata(ctx, bucket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.LogIf(ctx, err)
|
logger.LogIf(ctx, err)
|
||||||
|
wait() // wait to proceed to next entry.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// Check if there is a spare procs, wait 100ms instead
|
|
||||||
waitForLowIO(runtime.GOMAXPROCS(0), 100*time.Millisecond, currentHTTPIO)
|
wait() // wait to proceed to next entry.
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Reset(bucketMetadataRefresh)
|
t.Reset(bucketMetadataRefresh)
|
||||||
|
@ -2669,7 +2669,9 @@ func (p *ReplicationPool) loadResync(ctx context.Context, buckets []BucketInfo,
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
for index := range buckets {
|
for index := range buckets {
|
||||||
meta, err := loadBucketResyncMetadata(ctx, buckets[index].Name, objAPI)
|
bucket := buckets[index].Name
|
||||||
|
|
||||||
|
meta, err := loadBucketResyncMetadata(ctx, bucket, objAPI)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !errors.Is(err, errVolumeNotFound) {
|
if !errors.Is(err, errVolumeNotFound) {
|
||||||
logger.LogIf(ctx, err)
|
logger.LogIf(ctx, err)
|
||||||
@ -2678,18 +2680,10 @@ func (p *ReplicationPool) loadResync(ctx context.Context, buckets []BucketInfo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
p.resyncer.Lock()
|
p.resyncer.Lock()
|
||||||
p.resyncer.statusMap[buckets[index].Name] = meta
|
p.resyncer.statusMap[bucket] = meta
|
||||||
p.resyncer.Unlock()
|
p.resyncer.Unlock()
|
||||||
}
|
|
||||||
for index := range buckets {
|
tgts := meta.cloneTgtStats()
|
||||||
bucket := buckets[index].Name
|
|
||||||
var tgts map[string]TargetReplicationResyncStatus
|
|
||||||
p.resyncer.RLock()
|
|
||||||
m, ok := p.resyncer.statusMap[bucket]
|
|
||||||
if ok {
|
|
||||||
tgts = m.cloneTgtStats()
|
|
||||||
}
|
|
||||||
p.resyncer.RUnlock()
|
|
||||||
for arn, st := range tgts {
|
for arn, st := range tgts {
|
||||||
switch st.ResyncStatus {
|
switch st.ResyncStatus {
|
||||||
case ResyncFailed, ResyncStarted, ResyncPending:
|
case ResyncFailed, ResyncStarted, ResyncPending:
|
||||||
|
@ -658,6 +658,7 @@ func serverMain(ctx *cli.Context) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
logFatalErrs(err, Endpoint{}, true)
|
logFatalErrs(err, Endpoint{}, true)
|
||||||
}
|
}
|
||||||
|
bootstrapTrace("newObjectLayer (initialized)")
|
||||||
|
|
||||||
xhttp.SetDeploymentID(globalDeploymentID)
|
xhttp.SetDeploymentID(globalDeploymentID)
|
||||||
xhttp.SetMinIOVersion(Version)
|
xhttp.SetMinIOVersion(Version)
|
||||||
@ -719,6 +720,7 @@ func serverMain(ctx *cli.Context) {
|
|||||||
go func() {
|
go func() {
|
||||||
bootstrapTrace("globalIAMSys.Init")
|
bootstrapTrace("globalIAMSys.Init")
|
||||||
globalIAMSys.Init(GlobalContext, newObject, globalEtcdClient, globalRefreshIAMInterval)
|
globalIAMSys.Init(GlobalContext, newObject, globalEtcdClient, globalRefreshIAMInterval)
|
||||||
|
bootstrapTrace("globalIAMSys.Initialized")
|
||||||
|
|
||||||
// Initialize Console UI
|
// Initialize Console UI
|
||||||
if globalBrowserEnabled {
|
if globalBrowserEnabled {
|
||||||
@ -816,23 +818,26 @@ func serverMain(ctx *cli.Context) {
|
|||||||
// Initialize bucket metadata sub-system.
|
// Initialize bucket metadata sub-system.
|
||||||
bootstrapTrace("globalBucketMetadataSys.Init")
|
bootstrapTrace("globalBucketMetadataSys.Init")
|
||||||
globalBucketMetadataSys.Init(GlobalContext, buckets, newObject)
|
globalBucketMetadataSys.Init(GlobalContext, buckets, newObject)
|
||||||
|
bootstrapTrace("globalBucketMetadataSys.Initialized")
|
||||||
|
|
||||||
// initialize replication resync state.
|
// initialize replication resync state.
|
||||||
bootstrapTrace("go initResync")
|
bootstrapTrace("initResync")
|
||||||
go globalReplicationPool.initResync(GlobalContext, buckets, newObject)
|
globalReplicationPool.initResync(GlobalContext, buckets, newObject)
|
||||||
|
|
||||||
// Initialize site replication manager after bucket metadata
|
// Initialize site replication manager after bucket metadata
|
||||||
bootstrapTrace("globalSiteReplicationSys.Init")
|
bootstrapTrace("globalSiteReplicationSys.Init")
|
||||||
globalSiteReplicationSys.Init(GlobalContext, newObject)
|
globalSiteReplicationSys.Init(GlobalContext, newObject)
|
||||||
|
bootstrapTrace("globalSiteReplicationSys.Initialized")
|
||||||
|
|
||||||
// Initialize quota manager.
|
// Initialize quota manager.
|
||||||
bootstrapTrace("globalBucketQuotaSys.Init")
|
bootstrapTrace("globalBucketQuotaSys.Init")
|
||||||
globalBucketQuotaSys.Init(newObject)
|
globalBucketQuotaSys.Init(newObject)
|
||||||
|
bootstrapTrace("globalBucketQuotaSys.Initialized")
|
||||||
|
|
||||||
// Populate existing buckets to the etcd backend
|
// Populate existing buckets to the etcd backend
|
||||||
if globalDNSConfig != nil {
|
if globalDNSConfig != nil {
|
||||||
// Background this operation.
|
// Background this operation.
|
||||||
bootstrapTrace("initFederatorBackend")
|
bootstrapTrace("go initFederatorBackend")
|
||||||
go initFederatorBackend(buckets, newObject)
|
go initFederatorBackend(buckets, newObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user