You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "Mathdee (via GitHub)" <gi...@apache.org> on 2026/05/07 07:23:49 UTC
[I] [Task]: [Go][Prism] Resolve TODO: Optimize watermark reads in stageState using min-heap [beam]
Mathdee opened a new issue, #38403:
URL: https://github.com/apache/beam/issues/38403
### What needs to happen?
In `beam/sdks/go/pkg/beam/runners/prism/internal/engine/elementmanager.go`, the function `minPendingTimestampLocked` performs a linear scan over `ss.pendingByKeys` every time the watermark refreshes.
As noted in the existing comment inside that function:
`// TODO(lostluck): Can we figure out how to avoid checking every key on every watermark refresh?`
---
**The Fix:**
I will replace the current *O(K)* iteration over `ss.pendingByKeys` with a slice-based min-heap. This moves the retrieval of the minimum pending timestamp from a linear scan to a constant time (*O(1)*) lookup.
---
**Technical Details & Impact:**
- **Scaling:** The read latency stays at a flat 13ns no matter the number of keys (tested from 1k to 1M keys) which replaces the current linear growth.
- **Memory Efficiency:** There is 0 allocation because it doesn't create a temporary memory while reading data which removes most actions from the garbage collector, keeping the scheduler efficient.
- **CPU Friendly:** Instead of going over the memory to look for a map, it grabs what it needs from an organized list reducing additional CPU computation.
- **Consistent Speed:** The read time is locked at around 13ns, no matter the size of the pipeline the system will not jitter or slow down.
### Issue Priority
Priority: 2 (default / most normal work should be filed as P2)
### Issue Components
- [ ] Component: Python SDK
- [ ] Component: Java SDK
- [x] Component: Go SDK
- [ ] Component: Typescript SDK
- [ ] Component: IO connector
- [ ] Component: Beam YAML
- [ ] Component: Beam examples
- [ ] Component: Beam playground
- [ ] Component: Beam katas
- [ ] Component: Website
- [ ] Component: Infrastructure
- [ ] Component: Spark Runner
- [ ] Component: Flink Runner
- [x] Component: Prism Runner
- [ ] Component: Twister2 Runner
- [ ] Component: Hazelcast Jet Runner
- [ ] Component: Google Cloud Dataflow Runner
--
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: github-unsubscribe@beam.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Task]: [Go][Prism] Resolve TODO: Optimize watermark reads in stageState using min-heap [beam]
Posted by "Mathdee (via GitHub)" <gi...@apache.org>.
Mathdee commented on issue #38403:
URL: https://github.com/apache/beam/issues/38403#issuecomment-4395050764
Hey folks, taking this one on. I'll be working on this in my spare time, so I plan to have the PR and benchmarks ready for review by the end of May.
Thanks!
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Task]: [Go][Prism] Resolve TODO: Optimize watermark reads in stageState using min-heap [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #38403:
URL: https://github.com/apache/beam/issues/38403#issuecomment-6523069258
This issue has been marked as stale due to 150 days of inactivity. It will be closed in 30 days if no further activity occurs. If you think that’s incorrect or this issue still needs to be addressed, please simply write any comment. If closed, you can reopen the issue at any time. Thank you for your contributions.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Task]: [Go][Prism] Resolve TODO: Optimize watermark reads in stageState using min-heap [beam]
Posted by "Mathdee (via GitHub)" <gi...@apache.org>.
Mathdee commented on issue #38403:
URL: https://github.com/apache/beam/issues/38403#issuecomment-4395038047
.take-issue
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org