Skip to content

S3 Destination Uses Async Framework - #42405

Merged
Gireesh Sreepathi (gisripa) merged 16 commits into
masterfrom
epic-8349-certify-s3/issue-8554-s3-async-gt
Aug 1, 2024
Merged

Gireesh Sreepathi (gisripa) merged 16 commits into
masterfrom
epic-8349-certify-s3/issue-8554-s3-async-gt

Conversation

@johnny-schmidt

@johnny-schmidt Johnny Schmidt (johnny-schmidt) commented Jul 22, 2024 •

Copy link
Copy Markdown
Contributor

What

Migrates S3 to use the async framework.

This accomplishes

  • speed performance
  • checkpointing
  • counts

How

STTCPW: the old serial process

  • buffers files locally by stream in destination format
  • flushes when over threshold

Specifically, it used a single SerializedBufferingStrategy that handled creating file buffers by stream w/ format type and enforcing thresholds. State management, etc was handled upstream.

So I assigned one newly-created SerializedBufferingStrategy per async worker per flush.

Practically, this means that when a memory buffer reaches threshold, it starts, flushes, and closes a file buffer in a single pass. (This is all handled in S3DestinationFlushFunction)

Review guide

This is going to be the first in a series of breaking-changes for s3, so I'll be stacking pr's.

  1. async consumer
  2. support refreshes [+update metadata]

CHANGES WILL BE MERGEABLE WITH BREAKING CHANGES AFTER 2. 3 and 4 will constitute breaking changes.

Code changes consist of

  • test changes (added trace messages so consumer wouldn't fail)
  • automated name changes (S3Destination... -> S3DestinationAsync...)
  • new async consumer initialization (BaseS3Destination)
    ** NOTE: the flush function is initialized with a SerializedBufferingStragey provider so that no two threads use the same object!
  • stitching async to sync (S3DestinationFlushFunction)
    ** convert PartialAirbyteMessage to AirbyteMessage
    ** new SerializableBuffer method for flushing a single stream (so I can flush the buffers as soon as it finishes
    ** "default namespace": the async consumer replaces null namespaces w/ a default taken from the schema, which can break stuff in the s3 code that expects null; So I could either 1) make async accept null OR 2) thread an empty string through S3; I chose the latter to avoid impacting other code, though it is kind of ugly.

User Impact

Local testing shows a 2.5x speedup (from about 10mb/s peak to 25mb/s). However perf metrics collected from production data suggest we won't realize that speedup because few upstream sources perform over 10mb/s. So user impact might be minimal.

I'm not sure if counts or checkpoints are meaningful w/o metadata changes that will be part of the refresh PR? Practical effects of counts is that the platform crashes the sync if they don't line up, so we might see more reliability at the cost of higher failure rates.

BREAKING CHANGES

Technically this isn't a breaking change, but because the Async Consumer is dependent on trace messages to work properly:

  • metadata must be updated to indicate we support refresh
  • This only works with platform version > 0.63.7 in OSS, so they have to either upgrade the platform or downgrade the connector.

Gireesh Sreepathi (@gisripa) is working on this now.

Can this PR be safely reverted and rolled back?

  • [x ] YES 💚
  • NO ❌

I think? Keep me honest

@vercel

vercel Bot commented Jul 22, 2024 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
airbyte-docs ⬜️ Ignored (Inspect) Visit Preview Aug 1, 2024 9:44pm

Johnny Schmidt (johnny-schmidt) commented Jul 22, 2024 •

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join Johnny Schmidt (@johnny-schmidt) and the rest of your teammates on Graphite Graphite

@edgao Edward Gao (edgao) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

several small comments, lgtm once those are resolved. Like I said in one of my comments - either I'm missing something, or returning a new BufferingStrategy on every flush seems like something we'd want to do in all destinations?

@johnny-schmidt
Johnny Schmidt (johnny-schmidt) force-pushed the epic-8349-certify-s3/issue-8554-s3-async-gt branch from 27652f2 to 470eee5 Compare July 23, 2024 00:19

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very misleading typo here, fixed locally. (states => stats)

@johnny-schmidt
Johnny Schmidt (johnny-schmidt) force-pushed the epic-8349-certify-s3/issue-8554-s3-async-gt branch 2 times, most recently from f5414ea to 5c9ea03 Compare July 23, 2024 00:50

@edgao Edward Gao (edgao) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one last lgtm for formality's sake

@gisripa
Gireesh Sreepathi (gisripa) force-pushed the epic-8349-certify-s3/issue-8554-s3-async-gt branch from 5c9ea03 to 4d4e5db Compare July 24, 2024 17:53
@johnny-schmidt
Johnny Schmidt (johnny-schmidt) force-pushed the epic-8349-certify-s3/issue-8554-s3-async-gt branch from 4d4e5db to b7615bb Compare July 25, 2024 17:16
@gisripa
Gireesh Sreepathi (gisripa) force-pushed the epic-8349-certify-s3/issue-8554-s3-async-gt branch from b7615bb to 4d4e5db Compare July 25, 2024 18:43
@gisripa
Gireesh Sreepathi (gisripa) force-pushed the epic-8349-certify-s3/issue-8554-s3-async-gt branch 2 times, most recently from 88a707c to 5ac38e1 Compare July 25, 2024 18:47

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BaseGcsDestination.kt is failing compilation. Either we can choose to keep it backward-compat or split the changes of cdk and publish and work off of a published version.

@gisripa
Gireesh Sreepathi (gisripa) force-pushed the epic-8349-certify-s3/issue-8554-s3-async-gt branch from 3f06465 to b9aed56 Compare August 1, 2024 21:14
@gisripa

Gireesh Sreepathi (gisripa) commented Aug 1, 2024 •

Copy link
Copy Markdown
Contributor

/publish-java-cdk force=true

🕑 https://github.com/airbytehq/airbyte/actions/runs/10205922390
✅ Successfully published Java CDK version=0.44.0!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's simplify this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplify

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplify

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplify

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we can use string templates

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh god this is ugly. All because generationId can be 0... 😠

@gisripa
Gireesh Sreepathi (gisripa) force-pushed the epic-8349-certify-s3/issue-8554-s3-async-gt branch from b9aed56 to 165a2e5 Compare August 1, 2024 21:44
@@ -63,17 +60,19 @@ protected constructor(
catalog: ConfiguredAirbyteCatalog,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Re: line +58]

should we make the method final?

See this comment inline on Graphite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/connectors Connector related issues area/documentation Improvements or additions to documentation CDK Connector Development Kit connectors/destination/s3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants