Speeding up performance

Hi @ktosiek,

To answer your questions: The app is a customized CRM system, i.e. the database contains all kinds of information about clients, sessions with those clients, documentation and other typical CRM tasks. So not complex.

“Do you see a reason for your app to require a lot of memory?” The page that is not loading anymore (502 error) requires a lot of db queries as that page is a dashboard-like page that shows various information about the CRM. The dashboard page has around 20 functions that query the database in different ways to be able to present the information on the dashboard. Maybe that is indeed the reason I am getting the below error in the logs:

2024-11-18T06:35:13.320 app[...] ams [info] [2024-11-18 06:35:13 +0000] [323] [INFO] Using worker: sync

2024-11-18T06:35:13.324 app[...] ams [info] [2024-11-18 06:35:13 +0000] [329] [INFO] Booting worker with pid: 329

2024-11-18T06:35:13.348 app[...] ams [info] [2024-11-18 06:35:13 +0000] [330] [INFO] Booting worker with pid: 330

2024-11-18T06:35:14.318 proxy[...] ams [info] machine became reachable in 2.197278361s

2024-11-18T06:35:52.498 app[...] ams [info] [2024-11-18 06:35:52 +0000] [323] [CRITICAL] WORKER TIMEOUT (pid:329)

2024-11-18T06:35:53.526 app[...] ams [info] [2024-11-18 06:35:53 +0000] [323] [ERROR] Worker (pid:329) was sent SIGKILL! Perhaps out of memory?

2024-11-18T06:35:53.523 proxy[...] ams [error] [PU02] could not complete HTTP request to instance: connection closed before message completed

2024-11-18T06:35:53.534 app[...] ams [info] [2024-11-18 06:35:53 +0000] [342] [INFO] Booting worker with pid: 342

However, the database in production has about 100 clients or so. So, it is not an enormous amount of data which is why I am so surprised that it runs out of memory. Also, in my test environment the page loads more or less immediately, i.e. within half a second or so.

@khuezy to come back to your question whether my db is independent. I am actually not sure whether I gave you the right answer. In fly.io my app appears as an app and my database also appears as an app. So, I guess they are two separate apps that are connected. Is that what you meant to ask?