Performance (support issues)

To achieve the best performance for the Optima DB, you should run the DB on a Linux server. Best mount the pg_data folder on a partition that was mounted with the following parameters:
ext4, noatime, data=writeback, barrier=0, nobh, nodiratime
After mounting the partition:
- Stop the service postgresql.
- Set the PostgreSQL data folder as the partition directory. Example: /pg_data/. For Ubuntu, you do this in the file /etc/postgresql/10/main/postgresql.conf.
- Copy all data from the standard folder (for Ubuntu /var/lib/postgresql/10/main/) to the newly created folder (/pg_data/ in the example).
- Start the service postgresql.

When using large contiguous chunks of memory, you can use HugePages to reduce the overhead.
-
To estimate the number of required HugePages, first start PostgreSQL without HugePages enabled and check the virtual memory peak value VmPeak from the proc file system:
-
Use the command $> head -1 /path/to/data/directory/postmaster.pid.
This returns the value of the postmaster.pid, e.g. 4170. You are going to need it in the next step.
-
Use the command $> grep ^VmPeak /proc/4170/status.
This returns the value of the virtual memory peak, e.g. VmPeak: 6490428 KB.
-
In the example, calculate 6490428 / 2048 (PAGE_SIZE is 2 MB in this case).
This makes 3169.154, so you will need at least 3170 HugePages.
-
- Set up the system kernel using CONFIG_HUGETLBFS=y and CONFIG_HUGETLB_PAGE=y.
-
To set the number of HugePages, use the command:
$> sysctl -w vm.nr_hugepages=3170
Sometimes the kernel is not able to allocate the desired number of HugePages. In this case you need to repeat the command or reboot.
Important: Do not forget to add an entry to /etc/sysctl.conf to persist your settings through reboots.
You also need to set the right user permissions to use HugePages:
- Setting vm.hugetlb_shm_group via sysctl
- Setting the permission to lock memory with the command ulimit -l.
The default behavior for HugePages in PostgreSQL is to use them when possible and to fallback to normal pages when failing. To enforce the use of HugePages, you can set huge_pages to on.
Caution: If you enforce HugePages, PostgreSQL fails to start if not enough HugePages are available.

In general, you can achieve the best performance by running the Optima application server on a Linux server.
On a server that has 6 GB of RAM, you need to setup Java for large memory pages.
-
On a Linux server, check whether large page memory has been enabled, use the command:
$> cat /proc/meminfo
- If in the results not both HugePages_Total and HugePages_Free are greater than 0, enable large memory pages.
-
Check whether the Java Virtual Machine is running with the correct configuration parameters. Use the command:
$> ps aux | grep java | grep "UseLargePages".
- If the result does not list the java process with the option -XX:+UseLargePAges enabled, add this option to the configuration of the Java Virtual Machine.

To estimate the Hard Disk Drive (HDD) space requirements, you must consider these indicators:
Indicator | Description |
---|---|
RecomputeInt |
Time interval, measured in seconds [s] , between each computation start. See → ReComputeInt. |
SimSpan |
Span of the simulation, measured in seconds [s], defines the duration of the simulation starting from the initial instant. See → SimSpan. |
ResIntD |
Defines the duration, measured in seconds [s], of result intervals for the supply simulation. See → ResIntD. |
simuPerDay |
Number of simulations per day. simuPerDay=86400/RecomputeInt |
nlink |
Number of links. It is set by the model or is a value stored in PTV Optima DB where: |
resultsPerLinkPerSimulation |
Intervals per simulation. resultsPerLinkPerSimulation= (SimSpan/ResIntD)+1 |
recordSize |
Approximate size of each record for link result. The upper bound is set to 255 byte. The assumption is that all the fields are set. |
The main data types are links and turns, that needs a space of bytes per day calculated as shown in the table:
Data type | Bytes/Day | Typical values |
---|---|---|
Link results |
nLink x simuPerDay x resultsPerLinkPerSimulation x recordSize
|
EXAMPLE For a city like Karlsruhe and triggering a simulation every 5 minutes, the occupied space is approximately 20 GB per day. |
Turn results |
4 x (nLink x simuPerDay x resultsPerLinkPerSimulation x recordSize ) |
EXAMPLE For a city like Karlsruhe and triggering a simulation every 5 minutes, the occupied space is approximately 80 GB per day. |