Container Apps workers summarizing permit packets are thrashing on lock expirations. What Service Bus consumer tuning should the city apply?
Select an answer to reveal the explanation.
Short Explanation
Lock duration is how long the ticket stays “checked out” to a worker—if AI summarization takes longer than that window, the same job gets stolen mid-read. Prefetch is how many tickets the desk pulls at once.
Full Explanation
Container Apps (or Functions) workers that summarize permit packets need Service Bus lock duration long enough to cover typical AI processing, plus prefetch tuned so consumers stay busy without hoarding work they cannot finish. Increasing lock duration (and renewing locks when the host supports it) prevents the same message from becoming visible to another worker mid-summarization. Prefetch should match concurrency and processing time: enough to hide network latency, not so large that many messages sit locked while one slow PDF burns the lock window.
Setting lock duration to zero so messages never stay invisible fails conceptually: without a lock (or with an unusable lock window), competing consumers cannot safely claim exclusive work, and duplicate processing of the same permit packet becomes likely. Disabling prefetch entirely while also removing all concurrency limits without measurement fails operationally: you either under-utilize workers or stampede the model endpoint and Service Bus with unbounded parallel receives. Replacing Service Bus with synchronous App Service calls for every page of every PDF abandons the async municipal pattern entirely—back to held HTTP calls, timeouts, and poor scale under permit rushes.
Exam caveat: lock duration has a maximum; extremely long jobs may need checkpointing, continue-as-new patterns, or moving work off a single lock window rather than only cranking the lock. Prefetch interacts with PrefetchCount and client concurrency—tune with metrics, not guesses. Operational check: measure p95 summarization time, set lock duration with margin, watch for lock lost / delivery count increases, and adjust prefetch until throughput rises without a spike in abandoned or redelivered messages.