adrian-lin-1-0-0 opened a new pull request, #1037:
URL: https://github.com/apache/yunikorn-core/pull/1037

   ### What is this PR for?
   - Replace the DFS-based FindQueueByAppID (worst-case O(n) over all leaves) 
with an O(1) cached lookup.
   - Introduce a root-owned appID -> queuePath index to resolve the queue 
directly, then fetch the leaf by path.
   
   Key changes
   - Add a thread-safe appID -> queuePath index (RWMutex-protected).
   - Maintain the index on application add/remove.
   
   Performance
   - ~50x faster and far fewer allocations.
   
   ```
   goos: linux
   goarch: amd64
   pkg: github.com/apache/yunikorn-core/pkg/scheduler/objects
   cpu: AMD Ryzen 7 9800X3D 8-Core Processor           
   BenchmarkFindQueueByAppID_Cached-16          15605854                82.68 
ns/op           48 B/op          1 allocs/op
   BenchmarkFindQueueByAppID_Origin-16            290314              4143 
ns/op            4630 B/op         32 allocs/op
   ```
   
   ### What type of PR is it?
   * [ ] - Bug Fix
   * [x] - Improvement
   * [ ] - Feature
   * [ ] - Documentation
   * [ ] - Hot Fix
   * [x] - Refactoring
   
   ### Todos
   * [ ] - Task
   
   ### What is the Jira issue?
   [[YUNIKORN-2057] FindQueueByAppID is 
slow](https://issues.apache.org/jira/projects/YUNIKORN/issues/YUNIKORN-2057)
   
   ### How should this be tested?
   
   ### Screenshots (if appropriate)
   
   ### Questions:
   * [ ] - The licenses files need update.
   * [ ] - There is breaking changes for older versions.
   * [ ] - It needs documentation.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to