<@U04S8PLJWMT> why are my mssql cdc streams slow e...
# ask-ai
j
@kapa.ai why are my mssql cdc streams slow even for small tables and how can i speed it up?
k
There are several reasons why your MSSQL CDC (Change Data Capture) streams might be slow, even for small tables, and a few approaches you can take to improve performance: ### Common Causes of Slow MSSQL CDC Streams 1. Resource Constraints Insufficient CPU or memory allocated to Airbyte jobs can slow down CDC syncs. Even if your tables are small, if the Airbyte worker pods or containers are under-provisioned, performance will suffer. Monitoring and increasing resource limits (CPU/memory) can help, especially in Kubernetes or Docker deployments. [Source: Forum discussion on slow initial load and resource tuning](https://discuss.airbyte.io/t/1686) 2. SQL Server Agent Not Running The SQL Server Agent must be running for CDC jobs to function efficiently. If it's not running, CDC operations may hang or be delayed. [Source: MSSQL CDC setup documentation](https://docs.airbyte.com/integrations/sources/mssql#5-ensure-the-sql-server-agent-is-running) 3. Short CDC Retention Period If the retention period for CDC data is too short, Airbyte may miss changes or have to work harder to catch up, especially if syncs are infrequent. Increasing the retention period can help avoid missing data and reduce pressure on the sync process. [Source: Extending CDC retention period](https://docs.airbyte.com/integrations/sources/mssql#4-extend-the-retention-period-of-cdc-data) 4. Connector or Airbyte Version Issues Bugs or inefficiencies in older versions of Airbyte or the MSSQL connector can cause slowdowns or hangs. Upgrading to the latest versions has resolved performance issues for some users. [Source: Forum post on connector hanging and resolution by upgrading](https://discuss.airbyte.io/t/1323) 5. CDC Configuration and Table Setup CDC is only efficient on tables with primary keys and may not work well with certain data types or table configurations (e.g., clustered columnstore indexes are not supported). [Source: CDC limitations](https://docs.airbyte.com/integrations/sources/mssql#change-data-capture-cdc) 6. Airbyte Job Parallelism By default, Airbyte may not parallelize jobs optimally. Increasing job parallelism in your deployment (especially on Kubernetes) can improve throughput. [Source: Forum post on improving initial load speed](https://discuss.airbyte.io/t/1686) ### Steps to Speed Up MSSQL CDC Streams - Increase Airbyte Worker Resources: Allocate more CPU and memory to Airbyte jobs. - Upgrade Airbyte and Connectors: Use the latest versions to benefit from performance improvements and bug fixes. - Check SQL Server Agent: Ensure the SQL Server Agent is running. - Extend CDC Retention: Increase the retention period for CDC data to avoid missing changes during long syncs. - Optimize Table Selection: Only enable CDC on necessary tables, and ensure they have primary keys. - Tune Parallelism: Adjust Airbyte’s job parallelism settings to allow more concurrent processing. - Monitor and Adjust Buffer Sizes: For some destinations, increasing buffer parameters can help (e.g., for Snowflake, set buffer parameter to 50) [Source: Snowflake buffer tuning](https://discuss.airbyte.io/t/4373). If you have already tried these steps and still experience slowness, consider sharing logs and your configuration on the Airbyte forums or GitHub for more targeted troubleshooting. > If you need detailed instructions for any of these steps, let me know!
j
@kapa.ai how do i increase job parallelism ?
k
A message from kapa.ai
To increase job parallelism in Airbyte, you need to adjust several configuration parameters, especially if you are running Airbyte on Kubernetes. Here are the main ways to increase parallelism: 1. Increase MAX_SYNC_WORKERS This environment variable sets the maximum number of sync jobs that can run concurrently per worker. For example:
Copy code
yaml    worker:      extraEnv:        - name: MAX_SYNC_WORKERS          value: "10"  # Set to your desired level of parallelism
Or, in Helm chart V2:
Copy code
yaml    worker:      maxSyncWorkers: 10
[Scaling Airbyte - Concurrent Sync Limits](https://docs.airbyte.com/platform/enterprise-setup/scaling-airbyte) 2. Increase Worker Replicas By increasing the number of Airbyte worker pods, you allow more jobs to run in parallel. For example:
Copy code
yaml    worker:      replicaCount: 3  # Increase as needed
[Scaling Airbyte - Worker Replicas](https://docs.airbyte.com/platform/enterprise-setup/scaling-airbyte) 3. Adjust WORKLOAD_LAUNCHER_PARALLELISM This variable controls how many jobs can be started at once. The default is 10, but you can increase it:
Copy code
WORKLOAD_LAUNCHER_PARALLELISM=20
[Configuring Airbyte - Launcher](https://docs.airbyte.com/platform/operator-guides/configuring-airbyte#launcher) 4. Ensure Sufficient Resources Make sure your Kubernetes cluster has enough CPU and memory to handle the increased parallelism. Monitor resource usage and scale your nodes as needed. 5. Other Related Variables For older Airbyte versions, you may also see references to
SUBMITTER_NUM_THREADS
and
TEMPORAL_WORKER_PORTS
, but in recent versions, focus on
MAX_SYNC_WORKERS
and worker replicas for parallelism control. Tip: Each concurrent sync typically requires at least 3 pods (
orchestrator
,
read
,
write
), so ensure your cluster can handle the total number of pods for your desired parallelism level. For more details and examples, see the official documentation on [Scaling Airbyte](https://docs.airbyte.com/platform/enterprise-setup/scaling-airbyte) and [Configuring Airbyte](https://docs.airbyte.com/platform/operator-guides/configuring-airbyte#launcher).
j
@kapa.ai I see in the logs long waits for cdc events heartbeats, this table does not have a lot of activity, can how can Shorten idle waits for MSSQL CDC?
k
A message from kapa.ai
If you are seeing long waits for CDC event heartbeats in your Airbyte logs when syncing a low-activity MSSQL table, this is a known behavior. The connector waits for new change events, and when there is little or no activity, it relies on heartbeats to detect progress. This can cause syncs to take several minutes or even hang for a long time if no new data arrives. Current Situation: - The Airbyte MSSQL CDC connector uses a "first record wait time" (initial wait timeout) to determine how long to wait for new CDC events. If no new events (including heartbeats) are detected, the sync can remain idle for this period. - In some cases, if the heartbeat timestamp is not updated (e.g., due to no activity), the sync may run much longer than expected or even indefinitely, as described in [this GitHub issue](https://github.com/airbytehq/airbyte/issues/60304). How to Shorten Idle Waits: - The main way to control this idle wait is by adjusting the "first record wait time" (initial wait timeout) in the source configuration. Setting a lower value will cause the sync to time out and finish sooner if there is no new data. - However, the knowledge sources do not provide a direct setting for a separate "heartbeat timeout" for MSSQL CDC. The only documented control is the initial wait time, which applies to both first record and heartbeat waits. Workarounds: - If you need the sync to finish quickly even when there is no new data, reduce the initial wait timeout in your connector settings. - Be aware that, as of now, there is no documented way to force more frequent heartbeats or to set a dedicated heartbeat timeout for MSSQL CDC in Airbyte. This is a known limitation and has been discussed in GitHub issues, with some users suggesting code changes to handle this more gracefully in the future [source-mssql CDC sync runs infinitely during heartbeat change events](https://github.com/airbytehq/airbyte/issues/60304). Summary: To shorten idle waits for MSSQL CDC in Airbyte, lower the initial wait timeout in your source configuration. There is currently no separate heartbeat timeout setting available in the documented configuration. If you need more granular control, you may want to follow or contribute to the ongoing discussions and issues on GitHub regarding this behavior. --- If you need help finding or changing the initial wait timeout setting in your Airbyte configuration, let me know!