diff options
author | Rasmus Dahlberg <rasmus@rgdd.se> | 2023-03-18 16:55:50 +0000 |
---|---|---|
committer | Rasmus Dahlberg <rasmus@rgdd.se> | 2023-03-18 17:58:25 +0100 |
commit | 5c12f6ade6ebd444f05175a658e6b70bdde5046f (patch) | |
tree | 5cb859351bca1ac2fe1b41896334c79fea045494 /utils_ct.go | |
parent | 4233dde13c61f492023166c6bafda85ba7bb08b3 (diff) |
Tune number of workers
Diffstat (limited to 'utils_ct.go')
-rw-r--r-- | utils_ct.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/utils_ct.go b/utils_ct.go index 3c40ad0..eed3f6c 100644 --- a/utils_ct.go +++ b/utils_ct.go @@ -4,6 +4,7 @@ import ( "crypto/sha256" "fmt" "os" + "strings" "gitlab.torproject.org/rgdd/ct/pkg/metadata" ) @@ -36,6 +37,31 @@ func logs(md metadata.Metadata) (logs []metadata.Log) { return } +// maxWorkers reduces the number of workers for logs that don't appreciate too +// much parallel fetching (errors), or for which performance is equal or worse. +// Warning: this may be system-dependent, determined "by-hand" on 2023-03-18. +func maxWorkers(log metadata.Log, workers uint64) int { + if max := 40; strings.Contains(*log.Description, "Argon") && int(workers) > max { + return max + } + if max := 16; strings.Contains(*log.Description, "Google") && int(workers) > max { + return max + } + if max := 4; strings.Contains(*log.Description, "Cloudflare") && int(workers) > max { + return max + } + if max := 12; strings.Contains(*log.Description, "Let's Encrypt") && int(workers) > max { + return max + } + if max := 5; strings.Contains(*log.Description, "Sectigo") && int(workers) > max { + return max + } + if max := 2; strings.Contains(*log.Description, "Trust Asia") && int(workers) > max { + return max + } + return int(workers) +} + // proof formats hashes so that they can be passed to the merkle package func proof(hashes [][]byte) (p [][sha256.Size]byte) { for _, hash := range hashes { |