Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

randomize traffic if replicated

Chris Lu7348d2ae6398
diff --git a/weed/filer/filechunk_manifest.go b/weed/filer/filechunk_manifest.go
index 32008271bd..023d9e04a2 100644
--- a/weed/filer/filechunk_manifest.go
+++ b/weed/filer/filechunk_manifest.go
@@ -6,6 +6,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/wdclient"
"io"
"math"
+ "math/rand"
"net/url"
"strings"
"time"
@@ -142,6 +143,9 @@ func retriedStreamFetchChunkData(writer io.Writer, urlStrings []string, cipherKe
var shouldRetry bool
var totalWritten int
+ rand.Shuffle(len(urlStrings), func(i, j int) {
+ urlStrings[i], urlStrings[j] = urlStrings[j], urlStrings[i]
+ })
for waitTime := time.Second; waitTime < util.RetryWaitTime; waitTime += waitTime / 2 {
for _, urlString := range urlStrings {
var localProcesed int