db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3130) Reduce memory footprint of StoredRecordHeader
Date Sun, 14 Oct 2007 17:03:50 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12534645

Knut Anders Hatlen commented on DERBY-3130:

>From a quick look at the class, it seems like there are at least two obvious candidates
for improvement:

  1) Only four bits of the status field are in use, so it could be changed from int to byte

  2) The fields overflowId (int), overflowPage (long) and firstField (int) are only used if
the records are overflowed. Factoring out these fields could reduce the object size when there's
no overflow (which is the common case). One could either (a) create an inner class with these
three fields and let StoredRecordHeader have a reference to such an object, or null if the
fields are not needed, or (b) create a subclass of StoredRecordHeader which contains the extra

With Sun's Java 6 running in 32-bit mode, doing 1+2a will reduce the object size from 48 bytes
to 32 bytes. Doing 1+2b will reduce the size further down to 24 bytes. In 64-bit mode, the
sizes are 56 bytes -> 48 bytes -> 40 bytes. (I haven't actually implemented the changes
to find the numbers, only changed variable types and made variables static to see how eliminating
them would affect the size).

> Reduce memory footprint of StoredRecordHeader
> ---------------------------------------------
>                 Key: DERBY-3130
>                 URL: https://issues.apache.org/jira/browse/DERBY-3130
>             Project: Derby
>          Issue Type: Improvement
>          Components: Store
>    Affects Versions:
>            Reporter: Knut Anders Hatlen
>            Priority: Minor
> Derby's page cache often has a memory footprint that is much larger than pageSize*pageCacheSize.
One large contributor to the footprint is the array of StoredPageHeader objects in BasePage.
The memory consumed by these objects can be as large as, and sometimes even larger than, the
byte arrays containing the raw page data. (See for instance http://www.nabble.com/How-much-derby-need-memory--tf3307655.html.)
Reducing the size of the StoredPageHeader objects could therefore reduce Derby's memory footprint
significantly, especially if the page cache is large and contains many pages from tables with
small records or from indices.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message