=== modified file 'src/docbkx/en/dhis2_implementation_guide_installation.xml' --- src/docbkx/en/dhis2_implementation_guide_installation.xml 2013-03-21 12:29:03 +0000 +++ src/docbkx/en/dhis2_implementation_guide_installation.xml 2013-03-24 18:40:01 +0000 @@ -16,12 +16,19 @@ For a national server the recommended configuration is a quad-core 2 Ghz processor or higher and 12 Gb RAM or higher. Note that a 64 bit operating system is required for utilizing more than 4 Gb of RAM, the Ubuntu 12.04 64 bit edition is thus recommended. - For this guide we assume that 4 Gb RAM is allocated for PostgreSQL and 7 GB RAM is allocated for Tomcat. If you are running a different configuration please adjust the suggested values accordingly! The steps marked as optional, like the step for performance tuning, can be done at a later stage. + For this guide we assume that 7 Gb RAM is allocated for PostgreSQL and 7 GB RAM is + allocated for Tomcat/JVM, and that a 64-bit operating system is used. If you are running a different configuration please adjust the suggested values + accordingly! We recommend that the available memory is split roughly equally + between the database and the JVM. Remember to leave some of the physical memory to the + operating system for it to perform its tasks. The steps marked as optional, like the step for performance tuning, can be done at a later + stage. Create new user (optional) You might want to create a dedicated user for running DHIS - it is not recommended to run as the root user. Create a new user called dhis by invoking useradd -d /home/dhis -m dhis -s /bin/bash Then make the user able to perform operations temporarily as root user by invoking usermod -G admin dhis If there is no admin group you must create it first by invoking groupadd admin Then invoke passwd dhis to set the password for your account. Make sure you set a strong password with at least 15 random characters. You might want to disable remote login for the root account for improved security by invoking sudo passwd -l root Operating system kernel tuning These settings are optional except for the shared memory setting which is required for PostgreSQL memory allocation. Open the kernel configuration file by invoking sudo nano /etc/sysctl.conf At the end of the file add the following lines and save. - kernel.shmmax = 1073741824 + kernel.shmmax = 1610612736 net.core.rmem_max = 8388608 net.core.wmem_max = 8388608 Make the changes take effect by invoking sudo sysctl -p @@ -45,19 +52,28 @@ Do performance tuning by opening the following file by invoking sudo nano /etc/postgresql/9.2/main/postgresql.conf and set the following properties: - shared_buffers = 512MB - Determines how much memory PostgreSQL can use for caching of query data. Is set too low by default since it depends on kernel shared memory which is low on some operating systems. - work_mem = 10MB - Determines the amount of memory used for internal sort and hash operations. - maintenance_work_mem = 128MB - Determines the amount of memory PostgreSQL can use for maintenance operations such as creating indexes, running vacuum, adding foreign keys. Incresing this value might improve performance of index creation during the data mart process. - effective_cache_size = 3300MB - An estimate of how much memory is available for caching (not an allocation) and is used by PostgreSQL to determine whether a query plan will fit into memory or not (setting it too high might result in unpredictable and slow behavior). + shared_buffers = 768MB + Determines how much memory PostgreSQL can use for caching of data. Is set too low by + default since it depends on kernel shared memory which is low on some operating systems. + Raising it to more than 1GB usually does not help performance so always keep it in this + range. + work_mem = 5MB + Determines the amount of memory used for internal sort and hash operations. This setting + is per connection per query so a lot of memory may be consumed if raising this too + high. + maintenance_work_mem = 256MB + Determines the amount of memory PostgreSQL can use for maintenance operations such as + creating indexes, running vacuum, adding foreign keys. Incresing this value might improve + performance of index creation during the analytics and data mart generation processes. + effective_cache_size = 7000MB + An estimate of how much memory is available for caching (not an allocation) and is used by + PostgreSQL to determine whether a query plan will fit into the memory cache or not. Setting it + to a higher value than what is really available will result in poor performance. checkpoint_segments = 32 PostgreSQL writes new transactions to a log file called WAL segments which are 16MB in size. When a number of segments have been written a checkpoint occurs. Setting this number to a larger value will thus improve performance for write-heavy systems such as DHIS 2. checkpoint_completion_target = 0.8 Determines the percentage of segment completion before a checkpoint occurs. Setting this to a high value will thus spread the writes out and lower the average write overhead. - wal_buffers = 4MB + wal_buffers = 12MB Sets the memory used for buffering during the WAL write process. Increasing this value might improve throughput in write-heavy systems. synchronous_commit = off Specifies whether transaction commits will wait for WAL records to be written to the disk before returning to the client or not. Setting this to off will improve performance considerably. It also implies that there is a slight delay between the transaction is reported successful to the client and it actually being safe, but the database state cannot be corrupted and this is a good alternative for performance-intensive and write-heavy systems like DHIS 2.