# Worker scalability

**URL:** https://community.temporal.io/t/worker-scalability/7626
**Category:** Community Support
**Tags:** java-sdk
**Created:** [March 20, 2023, 8:42am UTC](https://community.temporal.io/t/worker-scalability/7626 "2023-03-20T08:42:38Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Pradnyapbhalekar](https://avatars.discourse-cdn.com/v4/letter/p/fbc32d/32.png) [@Pradnyapbhalekar](https://community.temporal.io/u/Pradnyapbhalekar)
#### Post date: [March 20, 2023, 8:42am UTC](https://community.temporal.io/t/worker-scalability/7626/1 "2023-03-20T08:42:39Z")

</div>

We have a requirement to scale workers basis the task-queue size, how do i retrieve the task-queue size metric (using this metric , from outside , i am planning to scale the worker pods in eks using horizontal pod scaling), plz help  
Is it possible to query the database directly to retrieve the queue size, if so , plz share the query as well.

---

<div class="post-metadata">

### Author: ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)
#### Post date: [March 20, 2023, 2:39pm UTC](https://community.temporal.io/t/worker-scalability/7626/2 "2023-03-20T14:39:33Z")

</div>

Don’t think there is a way to get exact task queue size but you can look at backlogs:

Server metrics, `service_latency_bucket`, for example:

`histogram_quantile(0.95, sum(rate(service_latency_bucket{operation=~"PollActivityTaskQueue|PollWorkflowTaskQueue"}[5m])) by (operation, le))`

(no workers polling on tq can cause backlog, which increases these latencies)

From SDK metrics side watch increased latencies of workflow and activity task schedule to start latencies: `workflow_task_schedule_to_start_latency`, `activity_schedule_to_start_latency`
