Skip to content

Performance Tips

MariaDB

The InnoDB buffer pool serves as a cache for data and indexes. It is a key component for optimizing MariaDB performance. Its size should be as large as possible to keep frequently used data in memory and reduce disk I/O - typically the biggest bottleneck.

By default, the size of the buffer pool is only 128 MB. You can change it using the --innodb-buffer-pool-size parameter in the database service config of your docker-compose.yml. M stands for Megabyte, G for Gigabyte. Do not use spaces.

If your server has plenty of physical memory, we recommend increasing the size to 1 or 2 GB:

services:
  mariadb:
    command: mysqld --innodb-buffer-pool-size=1G ...

Advanced users can further improve the database performance by changing additional parameters, for example based on recommendations provided by the mysqltuner.pl script.

Remember to also increase the memory available to services in case you are using Docker Desktop on Windows or macOS. If PhotoPrism and MariaDB are running in a virtual machine, the available memory must be increased as well. For details, refer to the corresponding documentation.

Storage

Local Solid-State Drives (SSDs) are best for databases of any kind:

  • database performance extremely benefits from high throughput which HDDs can't provide
  • SSDs have more predictable performance and can handle more concurrent requests
  • due to the HDD seek time, HDDs only support 5% of the reads per second of SSDs
  • the cost savings from using slow hard disks are minimal

Switching to SSDs makes a big difference, especially for write operations and when the read cache is not big enough or can't be used.

Never store database files on an unreliable device such as a USB flash drive, an SD card, or a shared network folder.

Memory

Indexing large photo and video collections benefits from plenty of memory for caching and processing large media files. Ideally, the amount of RAM should match the number of physical CPU cores. If not, reduce the number of workers as explained below.

Especially the conversion of RAW images and the transcoding of videos are very demanding. High-resolution panoramic images may require additional swap space and/or physical memory above the recommended minimum.

RAW image conversion and TensorFlow are disabled on systems with 1 GB or less memory. We take no responsibility for instability or performance problems if your device does not meet the requirements.

Server CPU

Last but not least, performance can be limited by your server CPU. If you've tried everything else, then only moving your instance to a more powerful device or cloud server may help.

Be aware that most NAS devices are optimized for minimal power consumption and low production costs. Although their hardware gets faster with each generation, benchmarks show that even 8-year-old standard desktop CPUs like the Intel Core i3-4130 are often many times faster:

CPU Benchmark

Legacy Hardware

It is a known issue that the user interface and backend operations, especially face recognition, can be slow or even crash on older hardware due to a lack of resources. Like most applications, PhotoPrism has certain requirements and our development process does not include testing on unsupported or unusual hardware.

In many cases, performance can be improved through optimizations. Since these can prove to be very time-consuming and cost-intensive in practice, users and developers must decide on a case-by-case basis whether this provides sufficient benefit in relation to the costs or whether the use of more powerful hardware is faster and cheaper overall.

We kindly ask you not to open a problem report on GitHub Issues for poor performance on older hardware until a full cause and feasibility analysis has been performed. GitHub Discussions or any of our other public forums and communities are great places to start a discussion.

That being said, one of the advantages of open source software is that users can submit pull requests with performance and other improvements they would like to see implemented. This will result in a much faster solution than waiting for a core team member to remotely analyze your problem and then provide a fix.

Troubleshooting

If your server runs out of memory, the index is frequently locked, or other system resources are running low:

Other issues? Our troubleshooting checklists help you quickly diagnose and solve them.

You are welcome to ask for help in our community chat. Sponsors receive direct technical support via email. Before submitting a support request, try to determine the cause of your problem.

Back to top