cache: Per-client fair-share bandwidth on table uplink #54

Merged
eva merged 2 commits from cache/per-client-uplink-fair-share into main 2026-09-09 15:36:58 -05:00
4 changed files with 12 additions and 13 deletions
Showing only changes of commit 25622cbf25 - Show all commits
+2 -2
View File
@@ -20,8 +20,8 @@ var (
logLevel string
logFormat string
maxConcurrentRequests int64
maxRequestsPerClient int64
maxConcurrentRequests int64
maxRequestsPerClient int64
uplinkBandwidth string
maxBytesPerClientPerSec int64
)
+1 -1
View File
@@ -21,7 +21,7 @@ type Config struct {
// Table-tier uplink bandwidth shaping (bytes/sec). Distinct from MaxRequestsPerClient.
// Empty/"0" uplink and 0 max_bytes_per_client_per_sec = disabled (current unlimited behavior).
UplinkBandwidth string `yaml:"uplink_bandwidth"` // e.g. "10MB" via go-units = bytes/sec
UplinkBandwidth string `yaml:"uplink_bandwidth"` // e.g. "10MB" via go-units = bytes/sec
MaxBytesPerClientPerSec int64 `yaml:"max_bytes_per_client_per_sec"` // absolute per-client cap; 0 = none
// Hardening limits (security/correctness)
-1
View File
@@ -212,7 +212,6 @@ func TestValidate(t *testing.T) {
}
}
func TestValidateUplinkBandwidth(t *testing.T) {
cases := []struct {
name string
+9 -9
View File
@@ -93,15 +93,15 @@ func TestServeHTTPBandwidthCap(t *testing.T) {
t.Cleanup(upstream.Close)
sc, err := NewWithOptions(Options{
Address: "127.0.0.1:0",
MemorySize: "1MB",
DiskSize: "0",
Upstream: upstream.URL,
MemoryGC: "lru",
DiskGC: "lru",
MaxConcurrentRequests: 20,
MaxRequestsPerClient: 10,
MaxObjectSize: "0",
Address: "127.0.0.1:0",
MemorySize: "1MB",
DiskSize: "0",
Upstream: upstream.URL,
MemoryGC: "lru",
DiskGC: "lru",
MaxConcurrentRequests: 20,
MaxRequestsPerClient: 10,
MaxObjectSize: "0",
MaxBytesPerClientPerSec: 1500, // 1.5KB/s
})
if err != nil {