The issue
We have a very simple installation with minimal extensions installed, and a very small community of about 50 people posting in one discussion per day that reaches around 500 replies. We are experiencing some consistently poor performance when opening and scrolling through discussions and I would like some help to try to diagnose the issue.
We were previously on a shared hosting environment and actually did not have these problems (but had other problems,) and we recently moved to a VPS where we are consistently seeing 4-6 second load times when loading a discussion.
A few things I've noticed:
1) Resources: No significant resources are being used, only 20% memory and <10% CPU is ever in use.
2) Does not seem related to size of discussion. All other topics I've found seem to talk about poor performance when discussion is large. In our case we get poor performance no matter how many replies there are to the discussion. Even a discussion with 20 replies takes 5 seconds to load.
3) Does not seem related to load. Performance is the same if many users are active or if site is dead.
4) MySQL settings seem to all be correct. It has 4GB of RAM allocated but is only using < 2GB.
5) I enabled slow_query_log and tried to find any problematic queries but really doesn't seem to be database-related. Moreover, the database is the same as it was when we were on the shared hosting environment so it's unlikely to be a case of missing indexes or anything like that.
Just looking at the API Calls, for example calling /public/api/posts regularly takes around 4 seconds. Compared to here on discuss.flarum.org the same API call returns in < 1 second.
I really cannot figure out what is going on so I am asking for some new ideas.
Thank you in advance.
Flarum information
Flarum core: 1.8.3
PHP version: 8.1.25
MySQL version: 8.0.35
Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, readline, Reflection, SPL, session, standard, bcmath, calendar, ctype, curl, dom, fileinfo, ftp, gd, iconv, imap, mbstring, mysqlnd, PDO, Phar, posix, SimpleXML, sockets, sqlite3, tokenizer, xml, xmlwriter, xsl, zip, mysqli, pdo_mysql, pdo_sqlite, xmlreader, xdebug
+------------------------------------+----------+------------------------------------------+
| Flarum Extensions | | |
+------------------------------------+----------+------------------------------------------+
| ID | Version | Commit |
+------------------------------------+----------+------------------------------------------+
| flarum-suspend | v1.8.1 | |
| flarum-tags | v1.8.0 | |
| the-turk-quiet-edits | 0.1.3 | |
| fof-user-directory | 1.3.2 | |
| fof-user-bio | 1.3.0 | |
| fof-recaptcha | 1.3.0 | |
| fof-nightmode | 1.5.3 | |
| fof-ignore-users | 1.2.0 | |
| fof-forum-statistics-widget | 1.1.0 | |
| flarum-subscriptions | v1.8.0 | |
| flarum-sticky | v1.8.0 | |
| flarum-statistics | v1.8.0 | |
| flarum-nicknames | v1.8.0 | |
| flarum-mentions | v1.8.2 | |
| flarum-markdown | v1.8.0 | |
| flarum-lock | v1.8.0 | |
| flarum-lang-english | v1.8.0 | |
| flarum-bbcode | v1.8.0 | |
| clarkwinkelmann-predefined-avatars | 1.0.1 | |
+------------------------------------+----------+------------------------------------------+