Hi! Serving BentoML on an AWS instance (with multi...
# ask-for-help
j
Hi! Serving BentoML on an AWS instance (with multiple models in a runner, CPU VM) • We have asynchronous functions, when sending multiple requests it seems to stop (probably because it cant serve 10 requests at a time) • Is there a way to queue things when running as
bentoml serve
or limit requests?
c
What’s the target concurrency of your API?
j
probably 2 or 3 requests being handled
anything on this?
c
there’s a request queue backlog already, are you looking for async endpoint - submitting a task, get a task id, and using task id to query result?
you can limit requests by setting the max_concurrency parameter
excessive requests will be rejected immediately in that case
the best architecture for this type of use cases would be enabling external queue. You can build external queue infra around your bentoml deployment. BentoCloud also has this feature built-in: https://docs.bentoml.com/en/latest/bentocloud/how-tos/autoscaling.html#external-queue
j
sorry i just came back for this
where can i change the max_concurrency?
im not using bentocloud, we are just hosting it in aws
j
Hi, when using non-Bentocloud BentoML server instance and the concurrency is 1 and max_concurrency is also 1 with a timeout of 60s. What happens if there are two requests simultaneously? Does it get queued and if 60s is not finished for the first request, the 2nd request receives a timeout?
c
it will reject the request with “429 too many requests”, which is expected behavior
I’d recommend don’t use max_concurrency, unless you have some sort of external queuing mechanism implemented. For most scenarios, if you’re not looking to offer tight SLAs or reliability under heavy load, just have each worker queue up the request is ok.
j
thanks @Chaoyu what would be the ideal settings for just allowing one request at a time for an async function? the queue mechanism should be at the backend calling it, right? another question, can this setting
Copy code
traffic={
         "concurrency": 32,  # An integer value
        ...
    }
be done in inside here?
Copy code
service = bentoml.Service(
        "inference_graph",
        runners=model_runnable.service_runners,
    )
Hi, it turns out we are using
v1.0.15
and will take some time to migrate. for now, we need a temporarily solution to the concurrency. Is there a way we can indicate it somewhere during serving?