-
Notifications
You must be signed in to change notification settings - Fork 168
feat: update route mechanism #777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #777 +/- ##
============================================
- Coverage 54.67% 15.81% -38.86%
============================================
Files 671 222 -449
Lines 78658 16628 -62030
============================================
- Hits 43006 2630 -40376
+ Misses 31981 13760 -18221
+ Partials 3671 238 -3433
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a new routing mechanism to improve performance by replacing the locked read/write approach with a Read-Copy-Update (RCU) pattern using atomic snapshots. The changes include introducing a snapshot-based routing system with debounced updates and optimized data structures.
Key changes:
- Replaced mutex-based route coordination with atomic snapshot pattern
- Added debounced route updates to batch changes and reduce overhead
- Introduced optimized snapshot data structures with pre-compiled regex and method-specific tries
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
pkg/model/router_snapshot.go | New snapshot data structures and compilation logic for lock-free routing |
pkg/model/router.go | Minor comment corrections and enhanced string representation for header-only routes |
pkg/common/util/stringutil/stringutil.go | Added utility function for generating trie keys with prefix support |
pkg/common/router/router_test.go | Comprehensive test suite comparing old vs new router implementations |
pkg/common/router/router_bench_test.go | Performance benchmarks demonstrating improvements in throughput and latency |
pkg/common/router/router.go | Complete rewrite of router coordinator using atomic snapshots and debounced updates |
pkg/common/router/mock/router.go | Mock implementation preserving old router behavior for comparison testing |
pkg/common/http/manager_test.go | Updated test configurations to use new router structure |
pkg/common/constant/http.go | Added constant for header value all levels pattern |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
ref: #699
update content can refer to: https://github.com/Alanxtl/pixiu-router-update
benchmark result: