tobybatch / kimai2

Docker containers for the kimai2 web application including docker-compose and kubernetes/helm deployment.
MIT License
183 stars 97 forks source link

[FEATURE] Use opcache & apcu / Increase performance #438

Closed LiaraAlis closed 1 year ago

LiaraAlis commented 1 year ago

Hello together,

I have noticed that my Kimai 2 which runs under Docker is very slow. After a quick investigation, I found that PHP does not run with either OPcache or APCu. I suggest including this in the image to greatly increase performance and significantly reduce load times.

tobybatch commented 1 year ago

Great idea. I will put it on the Todo list.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

LiaraAlis commented 1 year ago

Is it possible to include this soon? My kimai is very slow and I hope that implementing this will speed up the system.

tobybatch commented 1 year ago

@LiaraAlis I will get round to this but I'm a volunteer and have a day job so all this needs to be fitted around that. My Kimai time at the moment is preparing for the v2 release.

Please feel free to raise a PR with the changes in it, you'll need to add the extensions around about here:

https://github.com/tobybatch/kimai2/blob/main/Dockerfile#L119

and

https://github.com/tobybatch/kimai2/blob/main/Dockerfile#L227

kevinpapst commented 1 year ago

PHP 8.1 has opcache enabled by default in prod. Doesn't it? What benefit has APCU if the app does not use it?

But if you share the php.ini we can have a look what to improve. There are about 10 config keys which are really necessary for speed. Stuff like open_basedir = Off, increase realpath_cache, stop checking timestamps of files, unlimited opcode caching (safe, as a restart happens on updates I guess) ... could make a (huge) difference indeed.

tobybatch commented 1 year ago

php.ini from the (fpm) prod image

https://gist.github.com/tobybatch/9c67aca669b7db07a331e659940faa93

kevinpapst commented 1 year ago

for testing: https://github.com/tobybatch/kimai2/pull/444