Came across a discussion earlier today talking about opcache and some performance stuff, but can’t find it anymore. I’d like to share some thoughts.
From my experience, enabling opcache does help boosting flarum performance, but of course to a certain extend only.
LiteSpeed is also a choice to replace your nginx + php-fpm. I tried OpenLiteSpeed on local dev environment. People said that it is faster than nginx + php-fpm (idk, didnt run any test). Personally I just dont like the way of the panel and how it's configured, etc. so didnt really explore much on it.
That said, I feel that bigger improvement would come from Flarum gradually moving towards runtime environments like Swoole, FrankenPHP, RoadRunner, etc. These could potentially bring much better performance compared to the traditional request-per-process model.
There are some discussion over the years, hope to see it being officially supported one day:
https://discuss.flarum.org/d/19632-swoole-http-server-for-flarum
https://discuss.flarum.org/d/31875-has-anyone-tried-roadrunner-with-flarum
One main concern is that in those environment, static variable to be manually cleared on every request. Something I would like to know is that should we already start considering compatibility with long-running processes when writing extension now? like avoiding usage of static variables and always clear it every request
Would love to hear thoughts from others who have explored this as well.
almost forgot to mention, database queries is another issue, especially when it comes to third-party extension, there's still a few N+1 issues lying around in some of the fof extension also, but with aid of AI, I think it has become easier to debug such issues