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

High CPU on Postgres database when using coldchain monitoring #297

Open
jmbrunskill opened this issue Nov 7, 2024 · 1 comment
Open
Labels
bug Something isn't working Team Piwakawaka

Comments

@jmbrunskill
Copy link
Collaborator

jmbrunskill commented Nov 7, 2024

Describe the bug

Notify ties up a lot of resources on the Postgres Server querying for Cold Chain Data.
This process of individually querying each sensor has a lot of over head (lots of querys to process) vs a process that queried all relevent sensors at once then processed in notify.

Notify should also probably throttle itself so that it waits a little bit longer between query attempts.
Possibly user configurable, so that if you want to get more realtime alerts (e.g. 10s you can but in a big system you might want to only check for alerts every 5 or 10 minutes)

To Reproduce

Steps to reproduce the behaviour:

  1. Setup cold chain alerts for a significant number of sensors
  2. Check CPU usage for Postgres

Expected behaviour

Additional context

@jmbrunskill jmbrunskill added the bug Something isn't working label Nov 7, 2024
@kahn-msupply
Copy link

Hey team - just a couple of videos showing the CPU spiking - Happening roughly every 10 seconds. The CPU spiking is causing some slowness for mSupply users.

The ideal situation would be to migrate Postgres to a separate server so it does not throttle the CPU. I understand the CPU spiking is fairly normal, but if possible it would be great if the query could be optimised.

Screen.Recording.2024-11-08.at.9.07.36.AM.mov
Screen.Recording.2024-11-08.at.9.07.01.AM.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Team Piwakawaka
Projects
None yet
Development

No branches or pull requests

3 participants