Timesten - (Memory|Database) (Size|Space|Partition)
Table of Contents
1 - About
TimesTen manages database space using two separate memory partitions within a single contiguous memory space.
One partition contains:
- permanent data
- and the other contains temporary data.
Procedures, tables, or rows cannot be created in the database if the permanent or temporary data partition is full.
2 - Articles Related
3 - Data Partition
3.1 - Permanent
Permanent data includes the tables and indexes that make up a TimesTen database. When a database is loaded into memory, the contents of the permanent data partition are read from files stored on disk. The permanent data partition is written to disk during checkpoint operations.
The size of the permanent data partition (can be increased in size, but it cannot be decreased). This value must be set to at least 32 MB.
Increasing the size of a TimesTen database can be done on first connect. To avoid having to increase the size of a database, it is important not to underestimate the eventual database size.
To make size estimates, use the ttSize utility.
3.2 - Temporary
Temporary data includes locks, cursors, compiled commands, and other structures needed for command execution and query evaluation. The temporary data partition is created when a database is loaded into memory and is destroyed when it is unloaded.
The size of the temporary data partition (can be either increased or decreased in size for databases that do not participate in replication).
The only way to size it is empirically. You must run a workload and observe the memory usage metrics in order to adjust it accordingly.
3.3 - Total
You must make sure that you have a shared memory segment that is large enough to hold the database.
In general, the minimum size of this shared memory segment should be:
- LogBufMb is the Log Buffer size in MB
If a TimesTen database larger than 256GB is required, then you must configure Timesten in order to use large pages.
4 - How to
4.1 - change it
The connection attributes that control the size of the database when it is in memory are:
- PermSize (permanent data partition)
- and TempSize (temporary data partition)
The sizes of the permanent and temporary data partitions are set when a database is loaded into memory and cannot be changed while the database is in memory.
Then you must:
- change different values for the PermSize or TempSize attributes
- and then reload the database.
4.2 - Lock the database in the main memory
Example of Server DSN with a memory lock attribute:
[DI_TT_AGGR_STORE] Driver=/u01/app/oracle/product/TimesTen/tt1122/lib/libtten.so DataStore=/u01/app/oracle/product/aggregate_store/tt_aggr_store/di_tt_aggr_store LogDir=/u01/app/oracle/product/aggregate_store/logs PermSize=250000 TempSize=80000 MemoryLock=4 .......
You can see with the help of ttstatus if the data store is locked in memory.
TimesTen status report as of Mon Sep 3 12:03:00 2012 Daemon pid 908 port 53396 instance tt1122 TimesTen server pid 917 started on port 53397 ------------------------------------------------------------------------ Data store /u01/app/oracle/product/aggregate_store/tt_aggr_store/di_tt_aggr_store There are 11 connections to the data store Shared Memory KEY 0x1511c0df ID 462684168 (LARGE PAGES, LOCKED) ...............
5 - Monitoring
5.1 - Metadata
The TimesTen table SYS.MONITOR contains several columns that can be used to monitor usage of PermSize and TempSize. These columns include PERM_ALLOCATED_SIZE, TEMP_ALLOCATED_SIZE, PERM_IN_USE_SIZE, PERM_IN_USE_HIGH_WATER, TEMP_IN_USE_SIZE, and TEMP_IN_USE_HIGH_WATER.
Each of these columns show in KB units the currently allocated size of the database and the in-use size of the database. The system updates this information each time a connection is made or released and each time a transaction is committed or rolled back.
SELECT PERM_IN_USE_SIZE/PERM_ALLOCATED_SIZE*100, PERM_ALLOCATED_SIZE /1024 AS "PERM_ALLOCATED_SIZE (MB)" FROM sys.monitor;
5.2 - Sql Command
The dssize command of ttisql is used to report the current memory status of the permanent and temporary partitions as well as the maximum, allocated and in-use sizes for the database.
Command> dssize PERM_ALLOCATED_SIZE: 25600000 PERM_IN_USE_SIZE: 25595486 PERM_IN_USE_HIGH_WATER: 25595491 TEMP_ALLOCATED_SIZE: 25600000 TEMP_IN_USE_SIZE: 43684 TEMP_IN_USE_HIGH_WATER: 44633
6 - Support
6.1 - Database permanent space exhausted
Example of ODBC error that you can get when the permsize parameter is not enough large.
[TimesTen][TimesTen 184.108.40.206.0 ODBC Driver] [TimesTen]TT0802: Database permanent space exhausted -- file "blk.c", lineno 3450, procedure "sbBlkAlloc" (TimesTen error code = 802). ttBulkCp: Error received in file /u01/stage/08_AirlineDemo/airlines/TT/SA_TT_11Y.dmp, line 290 -- S1000: [TimesTen][TimesTen 220.127.116.11.0 ODBC Driver] [TimesTen]TT6220: Permanent data partition free space insufficient to allocate 141840 bytes of memory -- file "blk.c", lineno 3450, procedure "sbBlkAlloc" (TimesTen error code = 6220).