You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2007/10/14 19:03:50 UTC

[jira] Commented: (DERBY-3130) Reduce memory footprint of StoredRecordHeader

    [ 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 fields.

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: 10.4.0.0
>            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.