# Concurrency limits in temporal springboot

**URL:** <https://community.temporal.io/t/concurrency-limits-in-temporal-springboot/16810>\
**Category:** Community Support\
**Tags:** java-sdk, springboot\
**Created:** [March 15, 2025, 12:40am UTC](https://community.temporal.io/t/concurrency-limits-in-temporal-springboot/16810 "2025-03-15T00:40:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emilie](https://avatars.discourse-cdn.com/v4/letter/e/aeb1de/32.png) [@Emilie](https://community.temporal.io/u/Emilie)\
**Post date:** [March 15, 2025, 12:40am UTC](https://community.temporal.io/t/concurrency-limits-in-temporal-springboot/16810/1 "2025-03-15T00:40:48Z")

</div>

I’m trying to set a concurrency limit of **10** on a task queue that I have (_SelfServiceReqManagement_), and was a bit confused on the options available for spring boot. Here is a snippet of code I currently have:

```auto
  @Bean
  public WorkerFactory workerFactory(WorkflowClient workflowClient,
                                     ServiceNowReqManagementImpl serviceNowReqManagement) {
    WorkerFactory workerFactory = WorkerFactory.newInstance(workflowClient);

    WorkerOptions workerOptions = WorkerOptions.newBuilder()
        .setMaxConcurrentActivityExecutionSize(10)
        .build();

    Worker worker = workerFactory.newWorker("ServiceNowReqManagement", workerOptions);
    worker.registerActivitiesImplementations(serviceNowReqManagement);

    return workerFactory;
  }

```

Is this code equivalent to setting these configurations in application.yml?

```auto
spring:
  temporal:
    workers:
      - task-queue: ServiceNowReqManagement
        capacity:
          max-concurrent-activity-executors: 1

```

Do they serve the same purpose or does max-concurrent-activity-executors do something different (and if so, what)?

---

<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 16, 2025, 11:07pm UTC](https://community.temporal.io/t/concurrency-limits-in-temporal-springboot/16810/2 "2025-03-16T23:07:07Z")

</div>

> .setMaxConcurrentActivityExecutionSize(10)  
> Is this code equivalent to setting these configurations in application.yml?

> capacity:  
> max-concurrent-activity-executors: 10

yes, you are correct

> I’m trying to set a concurrency limit of **10** on a task queue

note that MaxConcurrentActivityExecutionSize is a per-worker option, so you have 2 workers polling on this task.queue, each worker would be able to execute up to 10 concurrent activities at any point

---

<div class="post-metadata">

**Author:** ![Emilie](https://avatars.discourse-cdn.com/v4/letter/e/aeb1de/32.png) [@Emilie](https://community.temporal.io/u/Emilie)\
**Post date:** [March 17, 2025, 2:00pm UTC](https://community.temporal.io/t/concurrency-limits-in-temporal-springboot/16810/3 "2025-03-17T14:00:57Z")

</div>

If I want to limit the number of workers using the yaml approach, does max-concurrent-workflow-executors do this? If not, is there a way to limit the number of workers with spring configurations?

---

<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 17, 2025, 2:22pm UTC](https://community.temporal.io/t/concurrency-limits-in-temporal-springboot/16810/4 "2025-03-17T14:22:01Z")

</div>

limit it by number of deployments of your springboot app, temporal spring boot starter creates a single worker per unique task queue you define as part of your ActivityImpl, WorkflowImpl annotations
