Estimating and Modifying the Memory Region Sizes for the Database

Database operations cannot complete successfully without allocation of sufficient memory. It is important to ensure proper memory sizing so that the database can efficiently store and process data fast. Allocating too little memory may lead to performance bottlenecks, increased latency, or even system crashes.

TimesTen manages database space using separate memory regions. To ensure adequate memory allocation, you must configure appropriate sizes for the permanent and temporary memory regions, the transaction log buffer, and the PL/SQL memory region.

Use the ttShmSize utility to determine the appropriate size for the shared memory segment and configure the following TimesTen connection attributes accordingly:

  • PermSize: Defines the size of the permanent memory region (in MB) for the database where actual data is stored. Ensure that PermSize is large enough to hold all data. You can increase this value, but not decrease it for this database. See PermSize in the Oracle TimesTen In-Memory Database Reference.

    You can decrease the permanent memory region by re-creating the database with a smaller size. See Reducing Database Size for TimesTen.

  • TempSize: Specifies the total amount of memory (in MB) allocated to the temporary region for the TimesTen database. Since the temporary data partition is recreated each time a database is loaded, the TempSize attribute can be increased or decreased each time a database is loaded. See TempSize in the Oracle TimesTen In-Memory Database Reference.

  • LogBufMB: Defines the size (in MB) of the internal transaction log buffer. A small LogBufMB can slow down write transactions because they must wait for a log flush to free up space for redo logging. The LogFileSize attribute defines the maximum size, in megabytes, of each transaction log file. If LogFileSize is set too small, TimesTen must create multiple log files during a single transaction log flush operation. For optimal performance, the value of LogFileSize should either match or be an integral multiple of LogBufMB. See Configure Log Buffer and Log File Size Parameters and LogBufMB in the Oracle TimesTen In-Memory Database Reference.

  • Connections: Specifies the maximum number of connections to the database. See Connections in the Oracle TimesTen In-Memory Database Reference.

In this example, the database1 database has a PermSize of 32768 MB, TempSize of 4096 MB, LogBufMB of 1024 MB. Let's use the ttShmSize to calculate the shared memory segment size:

$ ttShmSize -connstr "DSN=database1;PermSize=32768;TempSize=4096;LogBufMB=1024;Connections=2048"

The output is similar to the following and can change from release to release. This output is for example purposes only.

The required shared memory size is 39909884752 bytes.

If there are multiple TimesTen databases on your system, each using its own shared memory segment, the maximum shared memory segment size must be large enough to accommodate the largest database. Use the above example for each database. On Linux, for example, divide the total memory size by the system's page size (typically 4096 bytes) to calculate the total memory allocation in pages. See Configure shmmax and shmall.

Database invalidation doesn't happen very often. However, when it does happen, the shared memory segment for the invalidated database remains in place until all associated processes and connections are terminated. If you attempt to create a new copy of the database while the invalidated database memory segment is still in use, the system needs sufficient physical memory to accommodate the new copy. Therefore, it is recommended to allocate double the amount of memory compared to the size of the largest TimesTen database to ensure proper database recovery. If you don't permit this, and an invalidation happens, you won't be able to reload the database into memory until all processes and connections that are using the database are identified and terminated.

To configure the shared memory kernel parameters to control the size of the shared memory segment, see Configure Linux Kernel Parameters in Oracle TimesTen In-Memory Database Installation, Migration, and Upgrade Guide.