Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check why backend takes so much RAM #116

Closed
sleidig opened this issue Sep 21, 2023 · 3 comments
Closed

check why backend takes so much RAM #116

sleidig opened this issue Sep 21, 2023 · 3 comments

Comments

@sleidig
Copy link
Member

sleidig commented Sep 21, 2023

there might be a memory leak or some possible performance improvements in our service. Even small instances take up quite a lot of memory on the server.

  • What is the RAM a basic (no functionality) NestJS app normally takes? (deployed via docker, same as our build process here)
  • if that is less: What is taking up particular memory? And why is the memory not released after API requests?
@sleidig sleidig added the CC label Sep 22, 2023
@sleidig sleidig moved this from Triage to Todo [help wanted] in All Tasks & Issues Sep 22, 2023
@rudresh rudresh moved this from Todo [help wanted] to In Progress in All Tasks & Issues Oct 12, 2023
@rudresh rudresh self-assigned this Oct 12, 2023
@rudresh
Copy link

rudresh commented Nov 9, 2023

Observations:
During the investigation, I kept the cc instance of ndb-core application running for an extended period, spanning a couple of days. One key observation was that the RAM usage gradually increase over time. This phenomenon was consistently observed throughout the monitoring period.

All the requests made during this time period were longpoll requests. Other API calls, such as retrieving all documents, did not contribute significantly to the memory usage.

Possibilities:
It is highly likely that the memory leakage issue is specifically associated with the longpoll functionality within the application.

Recommendations:
To mitigate the memory leakage issue, I recommend the following actions:

  1. Temporary Removal of Longpolls: As a temporary measure to diagnose the issue, we can consider temporarily removing longpoll requests from the frontend.
  2. Instead of longpolls we can implement periodic synchronization calls that serve a similar purpose. This change will help isolate the impact of longpolls on RAM usage. Monitor the application's behavior to ascertain if the removal of longpolls results in a significant change in RAM usage.
  3. Review the longpoll` Functionality: Conduct an in-depth examination of the longpoll functionality and identify potential areas where memory leaks may be occurring.

These recommendations can act as starting point for addressing the memory leakage issue. Based upon the results further investigation and testing may be required to implement a long-term solution.

@sleidig sleidig moved this from In Progress to Priority (Core Team) in All Tasks & Issues Jan 5, 2024
@TheSlimvReal
Copy link
Contributor

Instead of polling the permissions document "manually" in the backend, we could also just wait until someone requests it and then update it in the backend. This might have the issue that permissions only become effective, once they are requested by a client.

@sleidig sleidig moved this from Priority (Core Team) to Todo (ready for work) in All Tasks & Issues Feb 8, 2024
@sleidig
Copy link
Member Author

sleidig commented Feb 13, 2024

Closing this in favor of the issue to switch from live to periodic syncing in the frontend, as that seems to be our best guess towards avoiding timeouts and related memory leak: Aam-Digital/ndb-core#2100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants