From e81e5fe19b306cdb5fb8d299492c36fce5ab2304 Mon Sep 17 00:00:00 2001 From: benmoriceau Date: Tue, 10 Oct 2023 15:12:34 -0700 Subject: [PATCH] Adaptive optimal batch size --- .../destination/bigquery/BigQueryAsyncStandardFlush.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airbyte-integrations/connectors/destination-bigquery/src/main/java/io/airbyte/integrations/destination/bigquery/BigQueryAsyncStandardFlush.java b/airbyte-integrations/connectors/destination-bigquery/src/main/java/io/airbyte/integrations/destination/bigquery/BigQueryAsyncStandardFlush.java index fb0492fe263c..ed88d44d8b40 100644 --- a/airbyte-integrations/connectors/destination-bigquery/src/main/java/io/airbyte/integrations/destination/bigquery/BigQueryAsyncStandardFlush.java +++ b/airbyte-integrations/connectors/destination-bigquery/src/main/java/io/airbyte/integrations/destination/bigquery/BigQueryAsyncStandardFlush.java @@ -60,7 +60,7 @@ public long getOptimalBatchSizeBytes() { // resource the connector will usually at most fill up around 150 MB in a single queue. By lowering // the batch size, the AsyncFlusher will flush in smaller batches which allows for memory to be // freed earlier similar to a sliding window effect - return 175 * 1024 * 1024; + return Double.valueOf(Runtime.getRuntime().maxMemory() * 0.2).longValue(); } }