-
Notifications
You must be signed in to change notification settings - Fork 330
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
API: Public timelines extremely slow because of DB query #11119
Comments
Comparison of the same query between venera.social
libranet.de
|
I'll run a mysqloptimize on the DB to see if it helps with the performance. |
Ok. After running That helped a lot with the global public timeline. But the local public timeline still doesn't load in the apps. 🤔 |
The local timeline is called with this parameter: Since this is really fast on my both machines, please have a look at your system. And possibly you can run the slow query with |
The query for But when I access
With explain:
Sorry. No idea why Github is messing with the spaces in the table. |
Looks like it is using a temporary table for something (sort?) instead of an index. When I run the same |
For a better comparison both results in one comment. Both nodes are on current RC. libranet.de
venera.social
|
Update: Now the global public timeline is slow again. Looks like the mysqloptimize did help for some time. That query takes more than 150 seconds now. So the problem is back for both public timelines and queries. |
I have changed my DB config to use more or less the default settings for MariaDB on Ubuntu. But that didn't improve the performance of these two queries. So I think it's not a config issue. |
Your optimizer does weird things. The explain looks at pirati.ca like this:
squeet.me:
|
I haven't changed anything on how the query optimizer should work. The only important config change compared to the default config is that I'm using a big InnoDB buffer pool. |
10.1.48 on both machines. |
Wow! That's very old. 😬 I'm on MariaDB 10.3.32 and I just considered to upgrade to the current old stable version 10.5.x. |
Ok. Before I go to bed I upgraded MariaDB to the latest stable version 10.6.5 and left the config mostly on default values. It didn't change anything. The queries for both public timelines are still super slow.
With explain on MariaDB 10.6.5
|
I guess this is another example that some queries we're using don't get along well with MariaDB 10.3 and later versions. After changing my DB config to use an ancient optimizer algorithm the queries are very fast now. I'll close this one and link it to the other DB performance issue. |
See also #11465 |
Bug Description
I have the problem that the public timelines don't show any content in Mastodon compatible apps. When I try to refresh them I get a general network error - the client is running into a timeout.
There is nothing in my server log. The Apache access log is not showing anything no error message and also no success response.
So I tried the same thing with a desktop browser to get meaningful messages or insights via the browser's console. I found out that e.g.
https://libranet.de/api/v1/timelines/home
is loading a JSON document in less than 800 ms. But when I try to loadhttps://libranet.de/api/v1/timelines/public
it takes more than 125000 ms (a.k.a. 2 minutes) to load the JSON document. And that's the reason why the public timelines don't work with e.g. Tusky or Husky.The same public timeline is loaded in less than 1 second (around 950 ms) when I access the standard web version via
https://libranet.de/community
.I had no idea why the API version takes so much time and the web frontend is so much faster. But I have found the cause.
I also have a very small test node with a barely used test account. On this node and with that account I don't have the issue. So maybe it's a DB performance issue? .... Yes, it is. I just tried it. The DB query takes 2 minutes!
Steps to Reproduce
Actual Result:
The API endpoint is so slow that the apps are giving up while loading the content and therefore don't show any content.
Expected Result:
The API path should be as fast as the path used by the web frontend.
Platform Info
Friendica Version:
2021.12-rc
Friendica Source:
git
PHP version:
7.4
SQL version:
10.3 MariaDB
The text was updated successfully, but these errors were encountered: