db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kristian Waagan (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-4661) Reduce size of encoding buffer for short character values
Date Fri, 14 May 2010 12:10:42 GMT

     [ https://issues.apache.org/jira/browse/DERBY-4661?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Kristian Waagan updated DERBY-4661:
-----------------------------------

    Attachment: derby-4661-1a-reduce_encoding_bz.diff
                derby-4661-1a-reduce_encoding_bz.stat

Attaching patch 1a.

* iapi/types/ReaderToUTF8Stream
The actual fix. Note the special case when the value length is zero. To avoid the issue for
shorter header lengths in the future, I used Math.max instead of handling valueLength == 0
specifically.

* other classes
Added StreamHeaderGenerater.getMaxHdrLength() and made SQLClob use it.

Some simple tests showed a performance improvement of around 30%. Real world workloads will
not see such a gain, but the fix may help heavily loaded servers somewhat where users are
inserting small data values using the streaming classes.

Regression tests passed.
Patch ready for review.

> Reduce size of encoding buffer for short character values
> ---------------------------------------------------------
>
>                 Key: DERBY-4661
>                 URL: https://issues.apache.org/jira/browse/DERBY-4661
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.7.0.0
>         Environment: Inserts using setXStream(int, Reader/InputStream, int/long) for
short values on character columns
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>         Attachments: derby-4661-1a-reduce_encoding_bz.diff, derby-4661-1a-reduce_encoding_bz.stat
>
>
> When inserting character values Derby converts from Java char to an on-disk encoding
of UTF-8. To to this, the user stream is read and the resulting bytes after conversion are
placed in a "translation buffer". The default size of the buffer is 32 KB. When inserting
a lot of short values, the pressure on the Java garbage collector is unnecessary high and
the allocation/GC also causes a somewhat higher CPU usage.
> This effect of this issue can easily be reduced by sizing the buffer in the appropriate
cases.

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


Mime
View raw message