Determining the Value of the PermSize Attribute

You must have enough memory available in both the permanent and temporary memory regions of every element for the database to operate successfully. You can monitor the amount of memory allocated, in-use, and in-use high-water for this two regions for the local element or all elements of the database by querying the SYS.V$MONITOR and SYS.GV$MONITOR system views, respectively, as shown next.
Command> SELECT elementid, perm_allocated_size, perm_in_use_size,
 perm_in_use_high_water, temp_allocated_size, temp_in_use_size,
 temp_in_use_high_water FROM sys.v$monitor;

  ELEMENTID:                1
  PERM_ALLOCATED_SIZE:      262144
  PERM_IN_USE_SIZE:         30338
  PERM_IN_USE_HIGH_WATER:   30338
  TEMP_ALLOCATED_SIZE:      131072
  TEMP_IN_USE_SIZE:         21073
  TEMP_IN_USE_HIGH_WATER:   24600

1 row found.
Command> SELECT elementid, perm_allocated_size, perm_in_use_size,
 perm_in_use_high_water, temp_allocated_size, temp_in_use_size,
 temp_in_use_high_water FROM sys.gv$monitor;

  ELEMENTID:                1
  PERM_ALLOCATED_SIZE:      262144
  PERM_IN_USE_SIZE:         30338
  PERM_IN_USE_HIGH_WATER:   30338
  TEMP_ALLOCATED_SIZE:      131072
  TEMP_IN_USE_SIZE:         21073
  TEMP_IN_USE_HIGH_WATER:   24600
 
 
  ELEMENTID:                3
  PERM_ALLOCATED_SIZE:      262144
  PERM_IN_USE_SIZE:         30289
  PERM_IN_USE_HIGH_WATER:   30322
  TEMP_ALLOCATED_SIZE:      131072
  TEMP_IN_USE_SIZE:         21070
  TEMP_IN_USE_HIGH_WATER:   24470
 
 
  ELEMENTID:                5
  PERM_ALLOCATED_SIZE:      262144
  PERM_IN_USE_SIZE:         30289
  PERM_IN_USE_HIGH_WATER:   30322
  TEMP_ALLOCATED_SIZE:      131072
  TEMP_IN_USE_SIZE:         20943
  TEMP_IN_USE_HIGH_WATER:   24407
 
 
  ELEMENTID:                2
  PERM_ALLOCATED_SIZE:      262144
  PERM_IN_USE_SIZE:         30338
  PERM_IN_USE_HIGH_WATER:   30338
  TEMP_ALLOCATED_SIZE:      131072
  TEMP_IN_USE_SIZE:         20943
  TEMP_IN_USE_HIGH_WATER:   24470
 
 
  ELEMENTID:                4
  PERM_ALLOCATED_SIZE:      262144
  PERM_IN_USE_SIZE:         30289
  PERM_IN_USE_HIGH_WATER:   30322
  TEMP_ALLOCATED_SIZE:      131072
  TEMP_IN_USE_SIZE:         21006
  TEMP_IN_USE_HIGH_WATER:   24407
 
 
  ELEMENTID:                6
  PERM_ALLOCATED_SIZE:      262144
  PERM_IN_USE_SIZE:         30289
  PERM_IN_USE_HIGH_WATER:   30322
  TEMP_ALLOCATED_SIZE:      131072
  TEMP_IN_USE_SIZE:         21006
  TEMP_IN_USE_HIGH_WATER:   24470
1 row found.

If necessary, increase the amount of memory allocated for either region by increasing the value of the PermSize or TempSize attribute. See Modify the Connection Attributes in a Database Definition.

You can estimate the value of the PermSize attribute based on the SQL schema and the expected number of rows for each table of the database with the ttSize utility. For example, if you eventually expect to insert 1,000,000 rows into the customers table, the table will need about 287 MB (300,448,527 bytes = 286.53 MB) available, as shown next.

% ttSize -tbl terry.customers -rows 1000000 database1
 
 Rows = 1000000
 
Total in-line row bytes = 300442597
 
Indexes:
  Range index TERRY.CUSTOMERS adds 5930 bytes
  Total index bytes = 5930
 
Total = 300448527

However, the ttSize utility is optimized for databases in TimesTen Classic. A database in TimesTen Scaleout uses 8 to 16 bytes more per row than a similar database in TimesTen Classic. Consider adding to the value calculated by the ttSize utility from 8 to 16 bytes per row for a more accurate estimate. In the case of the customers table, if you add 16 bytes per row to the value calculated by the ttSize utility, you will need about 302 MB (316,448,527 bytes = 301.79 MB) available.

If you repeat this estimate for every table of the database, you can get a rough idea of the size of the permanent memory region a database requires across all hosts by adding the estimated size of every table. However, the PermSize attribute defines the amount of memory allocated for an element, not the whole database. To determine how much of the size estimated for each table you must assign to each element you have to take into consideration the distribution scheme of the table:

  • For a table using a hash or reference distribution scheme, divide the number of rows by the number of replica sets before doing the estimation with the ttSize utility.

    Note:

    Consider that tables with a reference distribution scheme may reference key values unevenly. If your data uses one or more key values as reference more often then any other key value available, it is possible that dividing the number of rows by the number of replica sets would be an inaccurate calculation. You should take special considerations based on the composition of your data.

  • For a table using a duplicate distribution scheme, use the total number of rows for the estimation. After all, you find every row of a table using a duplicate distribution on every element of the database.

Considering that the customers table uses a hash distribution scheme and that the database1 database consists of three replica sets, each element should be able to store 333,334 rows, which represents 101 MB (100,209,711 + 16 * 333,334 bytes = 100.65 MB) in the permanent memory region (defined by the PermSize attribute) for just the customers table, as shown next.

% ttSize -tbl terry.customers -rows 333334 database1
 
Rows = 333334
 
Total in-line row bytes = 100203781
 
Indexes:
  Range index TERRY.CUSTOMERS adds 5930 bytes
  Total index bytes = 5930
 
Total = 100209711

For more information on the ttSize utility, see ttSize in Oracle TimesTen In-Memory Database Reference.