Repository navigation
[DO NOT MERGE] [Cloud_Spanner_to_Avro] Set maxNumWritersPerBundle to 50 - #4493
darshan-sj wants to merge 1 commit into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the efficiency of the Cloud Spanner to Avro export pipeline by adjusting the writer concurrency settings. By allowing more concurrent writers, the pipeline can better handle databases with a high number of tables, resulting in fewer and larger output files while maintaining memory stability. The change also includes a necessary update to the underlying Apache Beam SDK version. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the v1/pom.xml to specify a SNAPSHOT version for beam-sdks-java-core and modifies ExportTransform.java to configure the Avro write transform with withMaxNumWritersPerBundle(50) and withEvictWritersWhenFull(). I have no feedback to provide on these changes.
Summary & Motivation
In the
Cloud_Spanner_to_GCS_Avro(ExportPipeline) template,ExportTransformwrites exported Spanner rows to GCS usingAvroIO.writeCustomTypeToGenericRecords()with dynamic table destinations (SchemaBasedDynamicDestinations) and runner-determined sharding.By default,
WriteFilescaps the number of concurrently open writers per bundle at20(DEFAULT_MAX_NUM_WRITERS_PER_BUNDLE). When exporting Spanner databases with a large number of tables, a bundle can encounter more than 20 distinct table destinations, causing more frequent writer evictions (or shuffle spilling) and resulting in smaller, more fragmented output Avro files.This PR configures
.withMaxNumWritersPerBundle(50)on theAvroIOwrite transform inExportTransformto allow up to 50 concurrent open writers per bundle, reducing writer turnover and producing fewer, larger Avro files while keeping worker memory bounded.Changes Made
.withMaxNumWritersPerBundle(50).Testing
ExportTransformTest(11 tests) andVerifyDataBoostParallelismTest(9 tests) pass.Cloud_Spanner_to_GCS_Avroand ran a batch Dataflow export job against Cloud Spanner database, verifying all Avro files (~1.81 GiB) were exported to GCS without errors.