cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Ellis (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-5019) Still too much object allocation on reads
Date Fri, 21 Dec 2012 00:51:13 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-5019?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13537569#comment-13537569
] 

Jonathan Ellis commented on CASSANDRA-5019:
-------------------------------------------

You're right.  It would need to be more like this:

A Flyweight pattern is one approach.  Something like

{code}
class FlyweightColumns
{
  ByteBuffer[] names;
  ByteBuffer[] values;
  long[] timestamps;

  private int index;
  private FlyweightColumn instance = new FlyweightColumn();

  public IColumn getColumn(int i)
  {
     index = i;
     return instance;
  }

  private class FlyweightColumn implements IColumn
  {
    public ByteBuffer name()
    {
      return names[index];
    }

    ... 
  }
}
{code}

Obviously some caution would be required (like ABSC, this is not suitable for Memtable or
cache use) but this would be totally adequate for the main "read some columns for the user,
then serialize them back to the coordinator" path.

For more OO sugar we could move operations like "serialize columns to this OutputStream" into
ISortedColumns instead of exposing getColumn(int) directly, I include that mainly because
it is the easiest way to illustrate the FWC re-use.
                
> Still too much object allocation on reads
> -----------------------------------------
>
>                 Key: CASSANDRA-5019
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5019
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Jonathan Ellis
>             Fix For: 2.0
>
>
> ArrayBackedSortedColumns was a step in the right direction but it's still relatively
heavyweight thanks to allocating individual Columns.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message