Skip to content
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

[Bug]: StateBackedIterable serializes elements size for every element when ComposedCombine is used #33620

Open
2 of 17 tasks
stankiewicz opened this issue Jan 16, 2025 · 1 comment · May be fixed by #33626
Open
2 of 17 tasks

Comments

@stankiewicz
Copy link
Contributor

stankiewicz commented Jan 16, 2025

What happened?

StateBackedIterable which is part of FnHarness is reporting size for every element without looking at cost of encoding. Other parts of SDK take into account isRegisterByteSizeObserverCheap and depending on response they sample.

To reproduce:

  1. Implement ComposedCombine with 1k of accumulators
  2. Create input of millions of elements
  3. Combine globally.
  4. Run on Dataflow v2

Straggler - "Operation ongoing" with following stacktrace fragment:


[..]
 at app//org.apache.beam.sdk.transforms.CombineFns$ComposedAccumulatorCoder.encode(CombineFns.java:649)
  at app//org.apache.beam.sdk.coders.Coder.getEncodedElementByteSize(Coder.java:297)
  at app//org.apache.beam.sdk.coders.LengthPrefixCoder.getEncodedElementByteSize(LengthPrefixCoder.java:109)
  at app//org.apache.beam.sdk.coders.Coder.registerByteSizeObserver(Coder.java:291)
  at app//org.apache.beam.fn.harness.state.StateBackedIterable$WrappedObservingIterator.next(StateBackedIterable.java:141)
  at app//org.apache.beam.sdk.transforms.CombineFns$ProjectionIterable$1.next(CombineFns.java:638)
  at app//com.google.common.collect.Iterators$5.computeNext(Iterators.java:672)
  at app//com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:145)
  at app//com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:140)
  at app//foo.bar.MyAccumulator.mergeAccumulators(MyAccumulator.java:418)
[..]

Expected outcome - no straggler.

Issue Priority

Priority: 2 (default / most bugs should be filed as P2)

Issue Components

  • Component: Python SDK
  • Component: Java SDK
  • 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
  • Component: Samza Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner
@stankiewicz
Copy link
Contributor Author

.take_issue

@stankiewicz stankiewicz changed the title [Bug]: StateBackedIterable reports size for every element [Bug]: StateBackedIterable serializes elements size for every element when ComposedCombine is used Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment