This section describes the formulas for estimating Symfoware Server memory requirements.
Use the formula below to obtain a rough estimate of the memory amount used for Symfoware Server.
symfowareServerRequiredMemory = sharedMemoryAmount + localMemoryAmount
Shared memory amount
Refer to "Table: PostgreSQL Shared Memory Usage" in "Shared Memory and Semaphores" under "Server Administration" in the PostgreSQL Documentation for information on shared memory.
Local memory amount
localMemoryAmount = processStackArea + memoryUsedInDbSessionsThatUseTempTables + memoryUsedInDbSessionsThatPerformSortAndHashTableOperations + memoryUsedInMaintenanceOperations + baseMemoryUsedInEachProcess + memoryUsedPreparingForDataAccess
processStackArea
= max_stack_depth x (max_connections + autovacuum_max_workers + 9)
This formula evaluates to the maximum value.
Actually it is used according to the growth of the stack.
In the formula above, 9 is the number of processes that perform roles specific to servers.
memoryUsedInDbSessionsThatUseTempTables
= temp_buffers x max_connections
This formula evaluates to the maximum value.
Memory is gradually used as temporary buffers are used, and is released when the session ends.
memoryUsedInDbSessionsThatPerformSortAndHashTableOperations
= work_mem x max_connections
This formula evaluates to the maximum value.
Memory is gradually used as operations such as sort are performed, and is released when the query ends.
memoryUsedInMaintenanceOperations = maintenance_work_mem x (numOfSessionsPerformingMaintenance + autovacuum_max_workers)
Note that 'maintenance operations' are operations such as VACUUM, CREATE INDEX, and ALTER TABLE ADD FOREIGN KEY.
baseMemoryUsedInEachProcess
= 3MB x (max_connections + autovacuum_max_workers + 9)
This formula evaluates to the memory used when server processes are running.
In the formula above, 9 is the number of processes that perform roles specific to servers.
memoryUsedPreparingForDataAccess = variationAmount x (max_connections + autovacuum_max_workers + 4) where variationAmount = shared_buffers / 8KB x 4 bytes (note that 8KB is the page length, and 4 bytes is the size of page management data)
This formula evaluates to the memory required to access the database cache in the shared memory.
In the formula above, among the processes that perform roles specific to servers, 4 is the number of processes that access the database.