Hi community, Within one of my flow, data is sent ...
# ask-community
m
Hi community, Within one of my flow, data is sent over and stored in a postgres database. I noticed than when run within a prefect flow the task is 20 times slower than it usually is. I use docker storage and docker agents. When I run the comparison without prefect I used the exact same docker image. I was looking at the documentation but I couldn't figure out if throttling is used at some point by prefect to limit the amount of data sent or stored maybe?
k
Hey @Marie,when you use the image, is that with Prefect also like
flow.run()
? Are you setting limits on the container for cpu and mem? Is the Flow memory intensive?
m
Hey @Kevin Kho! When I use the image, I run the comparison without
flow_run()
. I'm not setting any limit on cpu or memory for the container (I was curious to see if there was any prefect default limit but I didn't find any?). No the flow is not really memory intensive
k
So if the flow was very fast before, then 20x longer might be possible. Prefect will have some overhead, but this is constant rather than being a factor. Prefect tracks the state of each of your task and each state change is a request to our API. That’s how the observability is provided. For one task, it takes 3 API requests so that is where the overhead can come from.
The Docker limits would be on your Docker. Prefect doesn’t set limits by default.
m
It was not that fast before, around ~1min before, now ~20min. This is for one task within a flow
Yes, that makes sense but I'm guessing prefect overhead is in the order of magnitude of ~seconds?
I'll need to deepdive into memory usage to see if there isn't anything weird going on here
But I can't really make sense of why it's faster when run as a standalone versus packaged in a prefect task
k
Yeah 1 min to 20 mins sounds drastic. Not seeing anything immediate. Could you try just using
task.run()
and timing that? Cuz that would just be running the Python function underneath. Is this one task without mapping?
m
Correct, no mapping!