# Where does ZeebeWorker code execute?

**URL:** <https://forum.camunda.io/t/where-does-zeebeworker-code-execute/37909>\
**Category:** Discussion & Questions\
**Tags:** workflow-execution\
**Created:** [May 30, 2022, 10:00am UTC](https://forum.camunda.io/t/where-does-zeebeworker-code-execute/37909 "2022-05-30T10:00:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JGeek](https://forum.camunda.io/user_avatar/forum.camunda.io/jgeek/32/20974_2.png) [@JGeek](https://forum.camunda.io/u/JGeek)\
**Post date:** [May 30, 2022, 10:00am UTC](https://forum.camunda.io/t/where-does-zeebeworker-code-execute/37909/1 "2022-05-30T10:00:34Z")

</div>

The [architecture](https://docs.camunda.io/docs/components/zeebe/technical-concepts/architecture/) document states that Zeebe brokers do not execute application code.

In a spring boot microservice, we mark the application code with @ZeebeWorker annotation to define a task type. These tasks are then referred in the bpmn workflow diagram. During startup, the microservice connects with the zeebe cluster to register the task types.

When the workflow is executed to start a process instance, where does the @ZeebeWorker code execute? If it executes inside the microservice jvm then how do we achieve horizontal scaling for bpmn service tasks implementations.

Thanks.

---

<div class="post-metadata">

**Author:** ![Philipp\_Ossler](https://forum.camunda.io/user_avatar/forum.camunda.io/philipp_ossler/32/25299_2.png) [@Philipp\_Ossler](https://forum.camunda.io/u/Philipp_Ossler)\
**Post date:** [June 1, 2022, 5:37am UTC](https://forum.camunda.io/t/where-does-zeebeworker-code-execute/37909/2 "2022-06-01T05:37:33Z")

</div>

Hi @JGeek ,

please have a look at the following docs: [Job workers | Camunda 8 Docs](https://docs.camunda.io/docs/components/concepts/job-workers/)

> [@JGeek](#):
>
> When the workflow is executed to start a process instance, where does the @ZeebeWorker code execute?

The job worker is executed in the app that contains the worker. So, your Spring Boot application (i.e. your microservice).

The process itself is executed in the workflow engine.

> [@JGeek](#):
>
> If it executes inside the microservice jvm then how do we achieve horizontal scaling for bpmn service tasks implementations.

There is a good blog post here: [Writing Good Workers For Camunda Cloud | by Bernd Rücker | berndruecker](https://blog.bernd-ruecker.com/writing-good-workers-for-camunda-cloud-61d322cad862)

In general, you can scale your workers by setting up more instances of it. If you have a JVM app then start more instances of it. If you run a Docker image then start another instance. In a production environment, you may use K8s to scale your workers.

Best regards,  
Philipp

---

<div class="post-metadata">

**Author:** ![JGeek](https://forum.camunda.io/user_avatar/forum.camunda.io/jgeek/32/20974_2.png) [@JGeek](https://forum.camunda.io/u/JGeek)\
**Post date:** [June 1, 2022, 11:35am UTC](https://forum.camunda.io/t/where-does-zeebeworker-code-execute/37909/3 "2022-06-01T11:35:39Z")

</div>

Ok I understand. Thanks for the links I will go through them.

Given that ZeebeWorker code executes in our jvm, what would be the use cases for scaling the zeebe brokers? Would that be just when there are large number of concurrent workflow executions?

Thanks

---

<div class="post-metadata">

**Author:** ![Philipp\_Ossler](https://forum.camunda.io/user_avatar/forum.camunda.io/philipp_ossler/32/25299_2.png) [@Philipp\_Ossler](https://forum.camunda.io/u/Philipp_Ossler)\
**Post date:** [June 3, 2022, 11:28am UTC](https://forum.camunda.io/t/where-does-zeebeworker-code-execute/37909/4 "2022-06-03T11:28:46Z")

</div>

> [@JGeek](#):
>
> Would that be just when there are large number of concurrent workflow executions?

Yes, kind of. If you have high throughput (i.e. high number of active process instances, or a high number of jobs or concurrent activities in general) then you want to have a bigger cluster of brokers.

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [January 31, 2024, 10:17am UTC](https://forum.camunda.io/t/where-does-zeebeworker-code-execute/37909/5 "2024-01-31T10:17:24Z")

</div>

Closed on January 31, 2024, 10:17am UTC


