mirror of
https://github.com/photoprism/photoprism-docs.git
synced 2026-04-25 10:45:52 +03:00
[GH-ISSUE #102] Add Documentation about changing --innodb-buffer-pool-size in mariadb correctly #24
Labels
No labels
bug
docs 📚
done
enhancement
enhancement
help wanted
idea
low-priority
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/photoprism-docs#24
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @iluvatyr on GitHub (Jan 30, 2022).
Original GitHub issue: https://github.com/photoprism/photoprism-docs/issues/102
Sometimes, a user would want to make his --innodb-buffer-pool-size larger for a quicker DB.
Using https://github.com/major/MySQLTuner-perl, which is a tool to check, review and optimize databases, and running it within the mariadb container shows (among other things), that the "innodb_log_file_size" size should be 25% of the "innodb-buffer-pool-size".
Here is part of the output from the tool:
Therefore when changing the inodb-buffer-pool-size to a higher size, the innodb_log_file_size should probably be changed accordingly.
e.g. when changing the buffer pool size to 2G, then innodb_log_file_size should be 512M, if there is one log file (256 if 2 etc.).
So it will look like following in the docker-compose.yaml of the database container:
command: mysqld --innodb-buffer-pool-size=2G --innodb_log_file_size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120More info about log file:
https://dev.mysql.com/doc/refman/8.0/en/innodb-redo-log.html
Maybe info about this can be updated within: https://docs.photoprism.app/getting-started/troubleshooting/performance/
@lastzero commented on GitHub (Jan 31, 2022):
Thanks a lot! 👍
I ran the latest version of the linked Perl script inside the MariaDB container using these commands:
This is the updated
mysqldcommand based on the recommendations:mysqld --table_open_cache=32768 --tmp_table_size=128M --max_heap_table_size=128M --join_buffer_size=1048576 --innodb-buffer-pool-size=1G --innodb_log_file_size=256M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=50New parameters:
--table_open_cache=32768 --tmp_table_size=128M --max_heap_table_size=128M --join_buffer_size=1048576 --innodb_log_file_size=256MIn addition,
innodb-buffer-pool-sizewas increased from256Mto1G.Although all the recommendations sounded plausible, I can't really say that it makes search queries any faster. On the contrary, they might even be slower now.
So I'll have to change settings back again next for comparison...
Especially the impact of a large
join_buffer_sizeisn't completely clear to me. The MariaDB docs say it makes sense to leave it low globally, while the script said it should be increased way above the default: