Hi everyone! Our team is using prefect to perform...
# ask-community
s
Hi everyone! Our team is using prefect to perform realtime document processing. We are currently emitting
events
to trigger flow runs. But, I've noticed that it takes 4~10s until the job submitted and actually starts running inside a worker. (Note: this is using a prefect cloud server, the workers are hosted on an AKS kubernetes cluster, we tested with very low volume (1 ~ 3 concurrent jobs) I've noticed that there are two environment variables
PREFECT_WORKER_QUERY_SECONDS
and
PREFECT_WORKER_PREFETCH_SECONDS
which you can configure to control the polling interval. My question is: 1. Would lowering these values make the job startup time faster? 2. When prefect workers poll for work, does it take one job? Or does it take multiple jobs at once? 3. What are other methods to optimize job startup time? Ideally, we'd like the job to start within 1~2 seconds.
n
hi @Sangwu - are you installing any dependencies at runtime? i.e.
EXTRA_PIP_PACKAGES
or something in a
pull
step?
s
not at all, the workers are already deployed within my AKS cluster
I'm running them via
.serve
n
oh ok nice. yeah those settings could be tweaked to pick up work faster but to answer this part
1. When prefect workers poll for work, does it take one job? Or does it take multiple jobs at once?
it will find N scheduled runs and submit them all as subprocesses