Skip to content

Commit e8dfce8

Browse files
authored
feat(hostport): implement port-reuse with least-used allocation strategy (#327)
* feat: implement sharded lock for HostPort port allocation - Add ShardCount config option for customizable shard count - Replace global mutex with per-shard locks to reduce contention - Use FNV-1a hash for consistent shard routing by GSS name - Support parallel port allocation across different shards - Default shard_count=1 for backward compatibility * feat(hostport): optimize concurrent port allocation with lock-free design - Replace sharded port pools with shared port pool - Use sync.Map for lock-free port lookup - Use atomic operations for port usage counting - Sharded locks only for pod allocation records - Change sharding key from GSS name to GS name for better distribution - Increase MaxShardCount from 128 to 256 This optimization reduces lock contention from 100% to ~0.4% in high-concurrency scenarios (500 workers). * feat(hostport): implement port-reuse with least-used allocation strategy - Replace portAmount/amountStat with portUsage counter array - Implement least-used allocation for cross-node port reuse - Remove unused shard_count config option - Fix unused attrIntValue in nodeport_test.go (lint)
1 parent 801f5a2 commit e8dfce8

5 files changed

Lines changed: 640 additions & 489 deletions

File tree

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ testbin/*
2525
*.swo
2626
*~
2727
.vscode
28+
.qoder/
2829

2930
# Temporary kustomize overlay for tracing
3031
config/.tracing-overlay-temp/
@@ -43,4 +44,7 @@ cover.out
4344
log_debug
4445

4546
# Go cache
46-
.cache
47+
.cache
48+
49+
# Local issue tracking
50+
问题/

0 commit comments

Comments
 (0)