# Multiple engine with shared database

**URL:** <https://forum.flowable.org/t/multiple-engine-with-shared-database/9366>\
**Category:** Uncategorized\
**Created:** [May 18, 2022, 9:01am UTC](https://forum.flowable.org/t/multiple-engine-with-shared-database/9366 "2022-05-18T09:01:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![venkata.rajamanickam](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@venkata.rajamanickam](https://forum.flowable.org/u/venkata.rajamanickam)\
**Post date:** [May 18, 2022, 9:01am UTC](https://forum.flowable.org/t/multiple-engine-with-shared-database/9366/1 "2022-05-18T09:01:06Z")

</div>

Hi,  
We are planning to create application with multiple flowable engine & multi tenant but connecting single database schema. And expecting the workload should be shared between the multiple engines, so that the application performance will not get affected when there is a high usage. Please let me know is any option to do the same.  
Thanks in Advance.

---

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [May 18, 2022, 10:18am UTC](https://forum.flowable.org/t/multiple-engine-with-shared-database/9366/2 "2022-05-18T10:18:55Z")

</div>

Not sure if this would work: as long as you use different tenantIds and the same version of the engines, it’s ok for regular API usage. The async executor of each engine however, will poll all jobs, not tenant-based, which makes this setup not ideal.  
It’s much easier to have a separate schema for this use case - what’s the reason why that’s not possible?

---

<div class="post-metadata">

**Author:** ![venkata.rajamanickam](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@venkata.rajamanickam](https://forum.flowable.org/u/venkata.rajamanickam)\
**Post date:** [May 19, 2022, 11:00am UTC](https://forum.flowable.org/t/multiple-engine-with-shared-database/9366/3 "2022-05-19T11:00:49Z")

</div>

@joram Thanks for your response.  
Actually we are looking for scalable engine. So that, we can scale up/down the number of engine based on the load which we expected. In such case, we can’t create/drop schema per engine. Please suggest.

---

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [May 23, 2022, 3:38pm UTC](https://forum.flowable.org/t/multiple-engine-with-shared-database/9366/4 "2022-05-23T15:38:03Z")

</div>

Adding more engines won’t add more scalability automatically - the bottleneck will always be the relational database. So adding more Flowable nodes, IF they are idempotent would allow you to handle more load - as long as the relational database is able to handle it.

---

<div class="post-metadata">

**Author:** ![venkata.rajamanickam](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@venkata.rajamanickam](https://forum.flowable.org/u/venkata.rajamanickam)\
**Post date:** [May 25, 2022, 4:56am UTC](https://forum.flowable.org/t/multiple-engine-with-shared-database/9366/5 "2022-05-25T04:56:28Z")

</div>

@joram Thanks for your response.  
We will consider the separate schema for each engine as you suggested.

Please let me know, in a single spring boot application configuring multiple flowable engine is possible? Like each engine will point to different DB schema.  
If that is feasible, please let me know how we can achieve that or share some documents/links for reference.

---

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [May 25, 2022, 7:28pm UTC](https://forum.flowable.org/t/multiple-engine-with-shared-database/9366/6 "2022-05-25T19:28:42Z")

</div>

It’s technically possible, but you’ll be going against the defaults of Spring Boot which assumes one datasource and one transaction manager (e.g. through the spiring.datasource.xyz properties). You’ll need a separate datasource / transaction manager beans for each Flowable engine. Do note that each engine has a threadpool for the async executor, which will be running on the same node and potentially compete for resources.

---

<div class="post-metadata">

**Author:** ![venkata.rajamanickam](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@venkata.rajamanickam](https://forum.flowable.org/u/venkata.rajamanickam)\
**Post date:** [May 26, 2022, 7:04am UTC](https://forum.flowable.org/t/multiple-engine-with-shared-database/9366/7 "2022-05-26T07:04:55Z")

</div>

@joram Thanks for your response.  
I understand the points you mentioned.  
Can you please recommend some documents / links here on configuring multiple flowable engine in single application. That would helps for me.
