# ask-ai

Nicolas Guary

02/15/2024, 7:52 AM
I have Dagster OSS deployed to a Kubernetes Cluster. I notice that sometimes there's a huge delay (around 10 minutes) between two steps let's say a dbt asset and then a python asset any idea on what can cause this?


02/15/2024, 7:52 AM
Delays between steps in a Dagster pipeline deployed to a Kubernetes cluster can be caused by several factors. Based on the documentation, here are some potential causes and troubleshooting steps you can consider: 1. Resource Initialization: If there is a resource that takes a long time to be created, it could introduce a delay. Check if any of your pipeline steps require initialization of resources that are time-consuming. 2. Subprocess Creation: The creation of individual subprocesses for each step might be taking a long time. This could be due to the overhead of starting new processes or containers for each step. 3. Kubernetes Infrastructure: Delays might be related to the Kubernetes infrastructure itself, such as slow pod scheduling, container image pulling, or resource constraints (CPU/memory) that lead to throttling. 4. Code Loading: The time it takes to import your Python module with your definitions in it could be a factor. This is the main work happening when a step starts executing. To troubleshoot these issues, you can: - Profile Your Code: Use tools like
to profile your code and identify where the process is spending the most time. This can help determine if the delay is within your code or due to external factors. - Monitor Kubernetes Events: Look at the Kubernetes events and logs to see if there are any issues with pod scheduling, container startup, or resource limits being hit. - Check Resource Initialization: Review the initialization code for any resources used by your steps to see if optimizations can be made. - Optimize Docker Images: If image pulling is slow, ensure that your Docker images are optimized for size and have all necessary dependencies pre-installed. - Evaluate Resource Requests and Limits: Make sure that your Kubernetes deployment has appropriate resource requests and limits set to prevent throttling and ensure quick scheduling. - Split Code Locations: If you have a large codebase, consider splitting it into more code locations. This way, each run will only need to load the code location in which its ops or assets are in, potentially reducing startup time. Remember to also check the specific configurations and logs for your Dagster and Kubernetes setup to get more insights into what might be causing the delays. If you continue to experience issues, you may want to look into the specific details of your deployment and the interactions between Dagster and Kubernetes.