Determining the exact amount of RAM needed for a PostgreSQL database serving DICOM image paths with Orthanc largely depends on how the system is utilized and the complexity of operations executed against the database. Here are some considerations for estimating memory requirements:
-
Assess the Orthanc Usage:
- Orthanc primarily stores metadata about DICOM studies in PostgreSQL. You need to assess the average size of this metadata.
- The web interface's complexity: The kinds of queries and operations users will be performing through the Orthanc web interface.
-
Estimate Database Size:
- Estimate the size of the metadata for one DICOM study and multiply it by 300,000 to get a rough idea of the expected database size.
-
Workload and Concurrency:
- With a maximum of 10 concurrent users, you may not need a vast amount of RAM allocated for connection overhead.
- Determine the nature of the queries and operations those users will be doing. Will they be running simple queries or more complex aggregations that require more
work_mem?
-
Shared_buffers:
- As a starting point, 25-50% of available system RAM can be allocated to
shared_buffers, but given that PostgreSQL delegates caching to the OS as well, you don’t need to provide excessive amounts here.
-
Work_mem:
- You may start with a lower
work_mem if query operations are not expected to be highly demanding. Monitor the system to see if sorts are spilling to disk, which would indicate a need for higher work_mem.
-
Maintenance_work_mem:
- You may set this higher if you will be performing heavy maintenance tasks, but with a database mainly consisting of DICOM metadata, this might not require a significant amount.
-
Effective_cache_size:
- Inform the optimizer about the expected cache available, which includes memory allocated to PostgreSQL and other system caches.
-
Baseline Requirements:
- A baseline PostgreSQL installation on Windows can run comfortably with a few GB of RAM for small to medium workloads, but your specific setup may require more.
As a rough estimate, you might start by provisioning a server with 8-16 GB of RAM for the described workload, assuming that the metadata for each DICOM study is not exceedingly large, and based on the factors presented above. However, this is a very general recommendation and should be fine-tuned through testing.
It's also worthwhile to note that if the data does not change frequently and most of the queries involve reading, the operating system's cache can efficiently serve these read requests, meaning you might not need to allocate excessive RAM to PostgreSQL itself.
Testing and Monitoring:
After setting up your PostgreSQL server, you should closely monitor memory usage and performance. You can adjust the settings to better accommodate your workload based on actual usage patterns. PostgreSQL provides various tools (pg_stat_statements, EXPLAIN, pg_stat_activity, etc.) that you can use to analyze the performance and resource utilization of your queries.
Remember to also consider future growth and anticipate changes in usage patterns as more users start using the system or the number of stored studies increases. Your memory requirements may evolve over time, so plan for scalability in your initial setup.