I'm having huge performance problems in Friendica since a few weeks. Today I analysed the problem and it seems Friendica is creating too much database connections. These connections remain active for more than 3 minutes and have the state "locked". The limit of maximum user connections is reached regulary. I probably cannot raise that limit because I use shared hosting.
I checked the database connections with: mysqladmin -i 5 processlist
The following queries are locked for a long time:
SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`, `contact`.`name` ...
SELECT `notify`.*, `item`.`visible`, `item`.`spam`, `item`.`deleted` FROM `notify` LEFT JOIN `ite ...
SELECT `id`, `parent`, `uri`, `contact-id`, `type`, `verb`, `visible` FROM `item` WHERE `id` IN ...
Unfortunately mysqladmin doesn't print the whole query but it may be enough to identify a query. There are more queries which are locked for a long time that I haven't noted yet.
However the result of these queries is that Friendica needs more than a minute to load and often it just displays: "An internal server error occurred. Please try again later."
I'm using the development version of Friendica and updated about half an hour ago (I did a git pull).