[bug] High CPU usage in PostgreSQL #569
Labels
No labels
approved, awaiting change
bug
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs docs
needs tests
not a bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: AkkomaGang/akkoma#569
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Your setup
OTP
Extra details
My VPS:
PostgreSQL Setting:
shared_buffers = 512MB
effective_cache_size = 1536MB
maintenance_work_mem = 128MB
work_mem = 26214kB
max_worker_processes = 2
max_parallel_workers_per_gather = 1
max_parallel_workers = 2
Version
3.9.2-0-g39a878f
PostgreSQL version
14
What were you trying to do?
Ever since migrating Pleroma to Akkoma, postgreSQL's CPU usage has been excessively high, severely impacting the performance of other programs, what should I do to solve this issue?
What did you expect to happen?
No response
What actually happened?
No response
Logs
No response
Severity
I cannot use it as easily as I'd like
Have you searched for this issue?
you've given us precious nothing to go on here
we cannot telepathically communicate with your database, we cannot answer "how should you solve this", you're going to need to do some digging here
I apologize for not joining the IRC channel before posting this issue. I thought that raising the issue in the repository would be helpful for others facing the same problem, as it allows for better tracking and resolution.
And I must acknowledge that my knowledge of PostgreSQL is currently limited. Thank you for reminding me of this important aspect! I will make an effort to learn more about PostgreSQL and gather the necessary information to provide a more detailed analysis of the issue.
I'm having a similar problem and went through pg_top to debug the issue. So far, I've found that this specific query is spamming the server:
Trying to find similar issues, I found two in upstream, one from three years ago and another from one year ago. One of the issues recommended doing a
VACUUM ANALYZE
, which I already did with no apparent success.After using pg_top and examining the PostgreSQL logs, I discovered that the same query was causing errors.
In addition, I have tried vacuuming and analyzing the database, but it did not make any changes.
try running
and grab the output
The output shows:
try actually running it on the correct database and not the default postgres one
Running in the akkoma database, the output shows:
ok well that explains a lot, this should take 2ms tops
you seem to... not have
activities_create_objects_index
can you give me the output of
\d activities
that should confirm my suspicion
the output of
\d activities
:ok
ok
pleroma did something WEIRD and changed their
activities_create_objects_index
great
GREAT
love it
a quick fix will be to run
that should bring you into line with the schema we use
this may take some time so be prepared to wait a little
Thank you so much! I have tried the quick fix and the query error is gone, the CPU usage has come down. Everything has gone back to normal now.
thanks for bringing it to my attention, i'll see why pleroma made the change that they did and add extra notes to migration docs
tell me if it does anything else weird, closing this off for now
Just as a post-mortem: this happened to me after manually migrating from Pleroma to Akkoma - could it be we're missing a migration?
quite possibly
this was apparently a known thing a while back, there is a note in the migration guide that should cover it - https://docs.akkoma.dev/stable/installation/migrating_to_akkoma/#warning-migrating-from-pleroma-develop
though I suppose it may have been missed if this migration has made it into stable