Creating a TimesTen Instance That Uses Automatic systemd Management
Configure the TimesTen Instance for systemd
Follow these steps to create the TimesTen instance with systemd:
Configure Linux Kernel Parameters for systemd
Configure shmmax and shmall in systemd
You must configure Linux shared memory so that the maximum size of a shared memory segment (the shmmax
memory kernel parameter) is large enough to contain the size of the total shared memory segment for the database. In TimesTen Classic, the entire database resides in a single shared memory segment. There is also a second memory segment used for PL/SQL.
On Linux, a shared memory segment consists of pages, where the default page size is normally 4 kB (4096 bytes). You can verify the default page size by running the getconf
PAGESIZE
command:
% getconf PAGESIZE 4096
Configure these shared memory kernel parameters to control the size of the shared memory segment:
-
shmmax
: The maximum size of a single shared memory segment expressed in bytes. The value must be large enough to accommodate the size of the total shared memory segment for the database. -
shmall
: The total size of shared memory segments system wide expressed in pages. The value is expressed in multiples of the page size (4 kB) andshmall * pagesize
must be greater or equal to the value ofshmmax
. It is recommended that you set the value ofshmall
to less than or equal to the total amount of physical RAM. To display the total amount of physical memory, run the Linuxcat /proc/meminfo
command.
Use the ttShmSize
utility to determine the size of the shared memory segment. The ttShmSize
utility uses the values of the PermSize
, the TempSize
, the LogBufMB
and the Connections
connection attributes (for a specified database) to determine this size. See ttShmSize in Oracle TimesTen In-Memory Database
Reference for details on the ttShmSize
utility and see PermSize, TempSize, LogBufMB, and Connections in Oracle TimesTen In-Memory Database
Reference for details on each connection attribute.
ttShmSize
utility with the -connStr
option to determine the size of the shared memory segment using the database1
DSN. Supply a PermSize
value of 32GB (32768 MB), a TempSize
value of 4 GB (4096 MB), a LogBufMB
value of 1 GB (1024 MB) and a Connections
value of 2048. % ttShmSize -connstr "DSN=database1;PermSize=32768;TempSize=4096;LogBufMB=1024;Connections=2048"
The required shared memory size is 39991547720 bytes.
Note:
-
The
-connStr
option of thettShmSize
utility requires that you have defined a DSN in either the user.odbc.ini
or the systemsys.odbc.ini
file. You may use any DSN. Note that for any connection attribute not specified in the-connStr
option,ttShmSize
uses the setting defined in either the user.odbc.ini
file or the systemsys.odbc.ini
file for the specified DSN. If the connection attribute is missing from both the-connStr
option and either the user.odbc.ini
file or thesys.odbc.ini
file,ttShmSize
uses the default value for the connection attribute. -
You can add a DSN to either the user
.odbc.ini
file of the user or the systemsys.odbc.ini
file. For example, to add thedatabase1
DSN to the user.odbc.ini
file of the current operating system user:% vi ~/.odbc.ini ... [database1]
To size shmmax
and shmall
:
Note:
-
The settings for
shmmax
andshmall
in these examples can be increased if there are other applications that require them to be greater. -
If you are unsure of the size of your database, you can set
shmmax
andshmall
to correspond to a percentage of the size of physical memory (such as 80%).
Configure HugePages
You can configure HugePages
for more efficient memory management.
Once configured, the memory allocated for HugePages
is taken from the total RAM on the Linux host and is not available for any other use. In addition, the HugePages
memory segment is automatically locked and cannot be swapped to disk.
To configure HugePages
, you need to know:
-
The maximum size of the shared memory segment for the database
-
The
HugePages
page size on your Linux host -
The group ID of the instance administrator
Using the examples in the Configure shmmax and shmall section, where the value of shmmax
value is 39,054,246 kB, and the Create the TimesTen Users Group section, where the group ID of the instanceadmin
user is 10000:
-
The size of the total shared memory segment is is 39,054,246 kB.
-
The
HugePages
page size is 2048 KB. (This value is fixed for each platform and is not configurable.)To determine the HugePages page size, run the Linux
cat /proc/meminfo|grep
Hugepagesize
command:% cat /proc/meminfo | grep Hugepagesize Hugepagesize: 2048 kB
-
The group ID is 10000.
To determine the group ID of the instance administrator, log in as the
instanceadmin
user, and run the Linuxid
command:% id uid=55000(instanceadmin) gid=10000(g10000)groups=10000(g10000)
To configure HugePages
:
Note:
-
Because
HugePages
must be allocated in contiguous available memory space, the requested allocation may not be granted, or may be only partially granted, until after the host is restarted. Check theHugePages_Total
andHugePages_Free
values from/proc/meminfo
. Restarting grants the full allocation, assuming enough memory is available in the host. -
The TimesTen PL/SQL shared memory segment consumes some of the configured HugePages allocation, determined by the value of the
PLSQL_MEMORY_SIZE
connection attribute. See PLSQL_MEMORY_SIZE in the Oracle TimesTen In-Memory Database Reference for more information. -
On Linux, the
HugePages
segment is automatically locked such that the memory segment is not a candidate to be swapped to disk. Therefore, if you configureHugePages
, you do not need to set theMemoryLock
connection attribute.
Set the Semaphore Values
TimesTen has an upper bound on the maximum number of connections to the database. The database connections consist of:
-
User connections: established by user applications
-
System connections: established internally by TimesTen (set at 48 connections)
-
Other required connections (set at 107 connections)
Each of these connections is assigned one semaphore, such that the total semaphores for a database are:
Total semaphores = user connections (N) + system connections (48) + other required connections (107) Total semaphores = N + 155
The semaphore settings are located in the kernel.sem
configuration directive in /etc/sysctl.conf
:
kernel.sem = SEMMSL SEMMNS SEMOPM SEMMNI
where:
-
SEMMSL
is the maximum number of semaphores per array. This value is related to the maximum number of connections. Configure this value to be155
plus the number of simultaneous user connections. -
SEMMNS
is the maximum number of semaphores system wide. Use the formulaSEMMNS
= (SEMMNI
* SEMMSL
) as a guideline. However, in practice,SEMMNS
can be much less thanSEMMNI
* SEMMSL
. -
SEMOPM
is the maximum number of operations for eachsemop
call. -
SEMMNI
is the maximum number of arrays.
Follow these steps to configure the SEMMSL
and the SEMMNI
settings. Ensure that the user is root
:
Note:
If you are using replication, the Linux platform for each host on which the master databases reside must have similar kernel settings for shared memory and semaphores. Specifically, theSEMMSL
and SEMMNI
settings must be large enough on all hosts that participate in an active standby replication scheme before the duplication is performed. In the event of a failover, the standby must be able to accommodate the active.
Set the SHMMNI Parameter
The SHMMNI
value controls the number of shared memory segments that the host can create simultaneously. TimesTen creates a shared memory segment for the TimesTen database and a shared memory segment for PL/SQL. In addition, there is a small shared memory segment that is allocated for the duration of each client/server connection. This shared memory segment is created at connect time and is destroyed when the client/server connection is disconnected from the TimesTen database. There is one shared memory segment per client/server connection.
You must configure the SHMMNI
parameter setting to account for the number of client/server connections. Set SHMMNI
to a value that is greater than number of expected client/server connections. (Ensure to also take into account the TimesTen shared memory segment, the PL/SQL shared memory segment, and other programs that use shared memory.) As an example, if you expect there to be 8000
client/server connections, an appropriate value is 9000
or greater. A value of 9000
or greater is appropriate as TimesTen has system connections that are not included in the client/server connections count.
Follow these steps to configure the SHMMNI
setting. Ensure that the user is root
:
Note:
If you are using replication, the Linux platform for each host on which the master databases reside must have a similarSHMMNI
kernel setting. Specifically, the SHMMNI
setting must be large enough on all hosts that participate in an active standby replication scheme before the duplication is performed. In the event of a failover, the standby must be able to accommodate the active.
Complete Remaining Steps for Automatic systemd Management
Complete the following steps to first review and, if necessary, modify the TimesTen service file. Then, install the TimesTen utility script by running the timesten_home/bin/setuproot
script. As a final step, run the systemd systemctl
start
command to start the TimesTen service.