Why can't I get Bonita Runtime (Tomcat bundle) to run smoothly with Postgresql on a Windows server?

I have created a system to manage various aspects of a university subject. Everything works correctly in the Studio, but after installing it on a Windows Server 2022 with Bonita Tomcat Bundle (2022.2) and PostgreSQL 12 on the same machine I have constant server crashes, with exorbitant CPU and RAM consumption when accessing some pages.

I have followed all the recommendations in the documentation to configure PostgreSQL but without success. The server has 16GB of RAM and 4 cores, well above the hardware requirements recommended in the documentation.

The BDM may have many objects and many relationships between objects, and the applications I’ve designed may require a lot of data to display, but everything works fine in Bonita Studio on a laptop with similar resources to the server.

If everything runs smoothly with H2, is the problem in the connection between Bonita and PostgreSQL?
Is there something I’m overlooking? 
Have I really created a system that is too big and complex for a server like this?

Please help.

Ok, I found the problem!

In fact, I was wrong when I asked the question because after further analysis of the problems, in H2 the system was not crashing but it was not going as fast as it should either.

First of all, thank you romain.bioteau for your interest in my case. The problems were with the same data and arose when accessing certain pages without a clear pattern.

Definitely the problem is to assume that to access the business data from the app it is the same to use an External API variable with 'lazyRef' or to use a Business data variable with the appropriate query. It is infinitely faster the second option as I have been able to verify in multiple pages that I have already changed.

I don't know the reason for the high resource consumption of the 'lazyRef' queries but clearly they were the source of my problems.

I am changing all the places where I used it and I think it is extremely important to strongly recommend not to use it unless there is no other choice or, if I have done something wrong, I think it should also be explained in the documentation.

I used indistinctly one method and the other and that's why it was so hard to find out why some pages went very well and others were terrible.

When you compare the h2 performance with Postgres performance, is it with the same dataset ?
Is it an overall performance degradation or just some specific queries ?

Glad you identified the issue.

The lazyRef filter is created when you generate a UID form from a task or process contract in edition mode.
If the contract was generated from a business data, we retrieve the type of the relation (eager or lazy).
When it’s lazy, the lazyRef filter is applied to do the additional API call to load the data.
If in your case you do not want to display the lazy relation, then it is indeed recommended to not use the lazyRef filters.