StreamSets

StreamSets

Connect with experts and peers to elevate technical expertise, solve problems and share insights.


#DataIntegration
#Data
 View Only
  • 1.  Performance bottleneck and concurrency questions for Redshift-to-Snowflake COPY INTO pipeline

    Posted 08/12/26 10:49 PM

    We are loading historical data from Redshift to Snowflake using StreamSets with COPY INTO.

    At the moment, throughput is very low on the StreamSets side. We are only able to load around 6 million rows per day, which is becoming a bottleneck.

    Our pipeline uses dynamic parameters, including:

    • database name
    • table name

    When we increased the number of threads from 1 to 4, we started seeing column mismatch / missing column issues during Snowflake COPY INTO. The errors indicate staged files sometimes contain a different number of columns than the target Snowflake table expects.

    Because of this, we suspect concurrency or shared writer/state issues when multiple tables are processed dynamically.

    Questions

    We would like guidance on the following:

    1. Would increasing the number of pipeline instances from 1 to 6 improve performance for this kind of Redshift-to-Snowflake historical load?

      • Are there best practices for scaling via instances vs threads?
      • Is multiple instances safer than increasing threads when database name and table name are dynamic?
    2. We saw schema/column mismatch issues when increasing threads from 1 to 4.

      • Could this be caused by shared writer state, batching, or staging behavior in StreamSets when dynamic table names are used?
      • Is there a recommended design pattern for dynamic table loads to Snowflake using COPY INTO?
    3. What is the recommended value for Min Batch Size / batch sizing in this type of load?

      • Is there guidance on row count per batch for improving throughput without risking instability?
      • Should batch size be tuned by row count, file size, or target table characteristics?
    4. If we stop the batch / stop the pipeline, is there any risk of data loss because StreamSets is holding data in memory or intermediate stage files?

      • How does StreamSets handle in-flight records during pipeline stop?
      • For source-to-stage-to-Snowflake flow, what guarantees exist around restart/recovery?
    Current observations
    • Single-thread execution is stable but slow
    • Increasing threads improves concurrency but introduces column mismatch issues
    • Throughput currently is about 6 million rows/day
    • Pipeline uses dynamic database/table parameters
    Request

    Please advise on:

    • recommended scaling strategy
    • safe concurrency model
    • batch-size tuning guidance
    • restart/stop behavior and any data-loss considerations


    ------------------------------
    Rahul Dharmawat
    ------------------------------


  • 2.  RE: Performance bottleneck and concurrency questions for Redshift-to-Snowflake COPY INTO pipeline

    Posted 26 days ago
    Edited by Eric Greisdorf 26 days ago

    Hi Rahul,

    I recommend a screen sharing with an expert to tune your specific use case. Please let me know if I can help arrange a working session.

    Different pipelines can have unique requirements, the suggestions below should be considered as guidelines only.

    Increasing concurrency can improve throughput, but I would first address the column mismatch before moving from one to six pipeline instances. Otherwise, additional instances may reproduce the same issue at a larger scale.
    For a historical multi-table load, one option StreamSets supports is using a multithreaded JDBC MultiTable Consumer with the Snowflake destination. Each origin thread reads from one table at a time and passes its batches to an available pipeline runner. Because different runners can process batches concurrently, the order in which batches reach the destination is not guaranteed. Also, ensure the JDBC origin's maximum connection pool size is at least equal to the configured number of threads.
    A few suggestions:

    1. Investigate the column mismatch first

    The mismatch is not necessarily evidence of shared writer state. It can also occur if records for different target tables are routed incorrectly, if the dynamic file/table expressions resolve inconsistently, or if a table's schema changed after the pipeline started. Confirm that the staging file pattern, target database, schema, and table are derived from record-specific fields or header attributes, rather than mutable pipeline-level parameters shared across concurrent processing. 

    2. Prefer controlled table-level parallelism

    For multi-table historical loads, start with multiple threads inside one pipeline and assign one thread per source table, up to the number of tables that can be processed concurrently. Configure enough Snowflake Executor connections to support the active tables, and ensure your Snowflake warehouse has enough resources. StreamSets documentation notes that additional Snowflake connections allow multiple tables to be written concurrently when using COPY, and the connection pool applies to the pipeline as a whole. [docs.streamsets.com]
    Multiple pipeline instances can improve throughput only if each instance has a clearly defined, non-overlapping work assignment, such as a dedicated list of tables or explicit key/date-range partitions. Running six identical instances against the same historical source selection could create duplicate processing or offset contention, depending on the origin and partitioning design.
    A safe model would be:Instance 1 processes an explicit subset of tablesInstance 2 processes a different subsetEach instance uses a unique staging path or prefixEach table has one active writer during initial troubleshootingSource partitions and restart boundaries are deterministic

    3. Increase batch size before scaling aggressively

    StreamSets recommends increasing the origin's maximum batch size from the typical default of 1,000 records to approximately 20,000 to 50,000 records per batch for Snowflake bulk loading. Heap size should be monitored and increased as needed because larger batches and additional threads consume more memory.
    Treat that range as a starting point rather than a universal setting. Test progressively, for example:

    10,000 -> 20,000 -> 30,000 -> 50,000 records

    Measure batch processing time, staged-file size, Data Collector heap and garbage collection, Redshift query pressure, Snowflake warehouse utilization, and destination errors. Row count is the StreamSets configuration control, but staged-file size and average row width should also be considered when evaluating the result.

    4. Validate staging isolation

    Because the Snowflake destination writes files to an internal or external stage and then instructs Snowflake to process those files, make sure separate files, tables, pipeline instances, and concurrent writers cannot unintentionally reuse or overlap staging locations or file-selection patterns.

    5. Stopping and restarting

    StreamSets processes data in batches. The origin records an offset, the batch moves through the pipeline, the destination writes it, and the offset is committed according to the configured delivery guarantee. Exact recovery behavior depends on the origin, destination, delivery guarantee, and pipeline configuration. 
    Therefore, I would not describe an arbitrary stop as universally loss-free or duplicate-free without reviewing those settings. For a bounded historical load, a clean approach is to let the origin emit a no-more-data event and route that event to a Pipeline Finisher. This allows expected processing to complete before the pipeline transitions to a finished state.
    My recommended sequence would be:
    1. Reproduce the problem with two threads.
    2. Confirm the resolved staging, target table and record schema for every failing batch.
    3. Assign unique stage prefixes where applicable.
    4. Start with a batch size of 10,000 records.
    5. Increase Snowflake Executor connections to match the number of concurrently written tables.
    6. Scale threads gradually while monitoring heap, batch latency, and Snowflake load history.
    7. Use multiple instances only after dividing the tables or partitions into non-overlapping assignments 

             

    If the mismatch continues, please open a support case and include the StreamSets version, pipeline export with credentials removed, origin and destination stage types, exact COPY INTO error, target-table DDL, failing staged-file metadata, thread and connection-pool settings, and whether any schemas are changing during execution. That information will help determine whether the issue is routing, schema discovery, staging isolation, or a product defect.



    ------------------------------
    Eric Greisdorf
    ------------------------------



  • 3.  RE: Performance bottleneck and concurrency questions for Redshift-to-Snowflake COPY INTO pipeline

    Posted 26 days ago

    Thanks a lot, Eric, for your reply.

    Could you please share your email address so I can connect with you directly?

    I'm also in touch with the IBM Account Manager for Fiserv.




    Regards
    Rahul





  • 4.  RE: Performance bottleneck and concurrency questions for Redshift-to-Snowflake COPY INTO pipeline

    Posted 26 days ago

    Hi Rahul,

    Of course, happy to help. My direct email is eric.greisdorf@ibm.com

    Please include Minh Tran (minh.a.tran@ibm.com). Minh is your IBM Data & AI Technical Specialist.

    Best Regards,

    Eric



    ------------------------------
    Eric Greisdorf
    ------------------------------