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

(Bug report) Avoid CPU Usage Spikes by improving the healthcheck script #4576

Open
AuthorShin opened this issue Jan 8, 2024 · 3 comments
Open

Comments

@AuthorShin
Copy link

Trilium Version

v0.62.5 Docker

What operating system are you using?

Other (specify below)

What is your setup?

Server access only

Operating System Version

Linux Vision 6.1.0-17-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.69-1 (2023-12-30) x86_64 GNU/Linux

Description

Hello
I was checking the CPU usage of the docker container of trilium and realized that there are big CPU spikes every 30 seconds which I believe is caused by the healthcheck script which we encountered on the other docker container for another app which might help you to fix the problem easier, you can read about and see the result of it here : louislam/uptime-kuma#2249

Also It's worth mentioning that it's a fresh install of trilium and there's no data that being added to it, which makes me wonder why there are a lot of disk writes cause by trilium all the time even we it's not open in the browser and there are no activities and no sync and no backup is active but the writes are consistent.

Error logs

Docker container of trilium logs

200 GET /api/health-check with 15 bytes took 0ms

200 GET /api/health-check with 15 bytes took 1ms

200 GET /api/health-check with 15 bytes took 2ms

200 GET /api/health-check with 15 bytes took 1ms

200 GET /api/health-check with 15 bytes took 1ms

200 GET /api/health-check with 15 bytes took 0ms

200 GET /api/health-check with 15 bytes took 0ms

200 GET /api/health-check with 15 bytes took 0ms

200 GET /api/health-check with 15 bytes took 2ms

200 GET /api/health-check with 15 bytes took 1ms

200 GET /api/health-check with 15 bytes took 0ms

200 GET /api/health-check with 15 bytes took 1ms

200 GET /api/health-check with 15 bytes took 0ms

200 GET /api/health-check with 15 bytes took 1ms

200 GET /api/health-check with 15 bytes took 2ms

200 GET /api/health-check with 15 bytes took 1ms

200 GET /api/health-check with 15 bytes took 1ms
@zadam
Copy link
Owner

zadam commented Jan 9, 2024

Hmm, healthcheck is a super simple implementation of returning just constant response. This shouldn't be causing CPU spikes.

@AuthorShin
Copy link
Author

@zadam I monitored the CPU usage of the container with Portainer, you can verify that as well.

@PretzelVector
Copy link

Hmm, healthcheck is a super simple implementation of returning just constant response. This shouldn't be causing CPU spikes.

Based on a cursory glance, I think the reported issue is that the current healthcheck launches node since the linked project fixed this issue by moving their healthcheck to a go-based implementation ( https://github.com/louislam/uptime-kuma/blob/482049c72b3a650c7bc5c26c2f4d57a21c0e0aa0/extra/healthcheck.js and https://github.com/louislam/uptime-kuma/blob/482049c72b3a650c7bc5c26c2f4d57a21c0e0aa0/extra/healthcheck.go ).

Not endorsing a go-based approach, but the follow-on issues with Portainer after moving to a new healthcheck are worth keeping an eye out for if a new healthcheck is implemented ( louislam/uptime-kuma#2774 (comment) ).

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

No branches or pull requests

3 participants