UltraLiteJ Database Performance Tuning Properties

Set properties to tune the performance of the UltraLiteJ database on the device based on the MBO model and the size of the data.

  • Page Size – The page size you choose can affect the performance or size of the database. UltraLiteJ, as in other databases, operates in units of page size. Larger page size may reuslt in higher inefficiency if space utilization of the page is low. In general, one page should be able to hold one row of data of the largest MBO type.
    Note: The default page size is set at code generation time. The page size cannot be changed after the database is created. If a database is already created, the page size at the time of the database creation will be in effect.
    // set 4K page size
        SUP101DB.getConnectionProfile().setPageSize(4096);
  • Cache Size – UltraLiteJ has a page cache with a default size of 20k or a minimum of 8 pages. If your page size is 4k, you will have a 32k page cache. Having a larger cache keeps more pages in memory at the expense of using up memory. It is recommended to experiment with different settings for your application to obtain the best performance.
    // set 100K cache size
        SUP101DB.getConnectionProfile().setCacheSize(102400);
  • Row Score Maximum and Row Score Flush Size – Row score is a measure of the references used to maintain recently used rows in memory. Each row in memory is assigned a score based on the number and types of columns they have, which approximates the maximum number of references they could use. Most columns score as 1; varchar binary, long binary and UUID score as 2; long varchar score as 4.

    When the maximum score threshold is reached, the flush size is used to determine how many old rows to remove.

    It is recommended that the flush size (measured as a row score) be kept reasonable (less than 1000) to prevent large interruptions.

    The default setting is 12000 for Row Score Maximum and 1000 for Row Score Flush Size.

    SUP101DB.getConnectionProfile().setProperty("rowScoreMaximum", "20000");
        SUP101DB.getConnectionProfile().setProperty("rowScoreFlushSize", "800");