cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Lerer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-8231) Wrong size of cached prepared statements
Date Tue, 04 Nov 2014 13:34:33 GMT

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

Benjamin Lerer commented on CASSANDRA-8231:
-------------------------------------------

The enum problem has been solved has part the JAMM issue #17 (Do not count size of referenced
classes). When I use the latest version of JAMM for a query like: {{Select * from test where
id = ?}} the object graph is:
{code}
root [org.apache.cassandra.cql3.statements.SelectStatement$Parameters] 24 bytes
   |
   +--orderings [java.util.LinkedHashMap] 56 bytes
      |
      +--table [java.util.HashMap$Entry[]] 16 bytes
      |
      +--header [java.util.LinkedHashMap$Entry] 40 bytes

root [org.apache.cassandra.cql3.statements.Selection$SimpleSelection] 32 bytes
   |
   +--metadata [org.apache.cassandra.cql3.ResultSet$Metadata] 32 bytes
   |  |
   |  +--names [java.util.ArrayList] 24 bytes
   |  |  |
   |  |  +--elementData [java.lang.Object[]] 32 bytes
   |  |     |
   |  |     +--2 [org.apache.cassandra.config.ColumnDefinition] 48 bytes
   |  |     |  |
   |  |     |  +--type [org.apache.cassandra.db.marshal.UTF8Type] 16 bytes
   |  |     |  |  |
   |  |     |  |  +--reverseComparator [org.apache.cassandra.db.marshal.AbstractType$1] 16
bytes
   |  |     |  |
   |  |     |  +--name [org.apache.cassandra.cql3.ColumnIdentifier] 24 bytes
   |  |     |  |  |
   |  |     |  |  +--text [java.lang.String] 24 bytes
   |  |     |  |  |  |
   |  |     |  |  |  +--value [char[]] 24 bytes
   |  |     |  |  |
   |  |     |  |  +--bytes [java.nio.HeapByteBuffer] 48 bytes
   |  |     |  |     |
   |  |     |  |     +--hb [byte[]] 24 bytes
   |  |     |  |
   |  |     |  +--cfName [java.lang.String] 24 bytes
   |  |     |  |  |
   |  |     |  |  +--value [char[]] 32 bytes
   |  |     |  |
   |  |     |  +--ksName [java.lang.String] 24 bytes
   |  |     |  |  |
   |  |     |  |  +--value [char[]] 64 bytes
   |  |     |  |
   |  |     |  +--componentIndex [java.lang.Integer] 16 bytes
   |  |     |
   |  |     +--1 [org.apache.cassandra.config.ColumnDefinition] 48 bytes
   |  |     |  |
   |  |     |  +--type [org.apache.cassandra.db.marshal.Int32Type] 16 bytes
   |  |     |  |  |
   |  |     |  |  +--reverseComparator [org.apache.cassandra.db.marshal.AbstractType$1] 16
bytes
   |  |     |  |
   |  |     |  +--name [org.apache.cassandra.cql3.ColumnIdentifier] 24 bytes
   |  |     |     |
   |  |     |     +--text [java.lang.String] 24 bytes
   |  |     |     |  |
   |  |     |     |  +--value [char[]] 24 bytes
   |  |     |     |
   |  |     |     +--bytes [java.nio.HeapByteBuffer] 48 bytes
   |  |     |        |
   |  |     |        +--hb [byte[]] 24 bytes
   |  |     |
   |  |     +--0 [org.apache.cassandra.config.ColumnDefinition] 48 bytes
   |  |        |
   |  |        +--name [org.apache.cassandra.cql3.ColumnIdentifier] 24 bytes
   |  |           |
   |  |           +--text [java.lang.String] 24 bytes
   |  |           |  |
   |  |           |  +--value [char[]] 24 bytes
   |  |           |
   |  |           +--bytes [java.nio.HeapByteBuffer] 48 bytes
   |  |              |
   |  |              +--hb [byte[]] 24 bytes
   |  |
   |  +--flags [java.util.RegularEnumSet] 32 bytes
   |     |
   |     +--universe [org.apache.cassandra.cql3.ResultSet$Flag[]] 32 bytes
   |
   +--columns [java.util.ArrayList] 24 bytes
      |
      +--elementData [java.lang.Object[]] 32 bytes

root [org.apache.cassandra.cql3.statements.Restriction[]] 24 bytes
   |
   +--0 [org.apache.cassandra.cql3.statements.SingleColumnRestriction$EQ] 24 bytes
      |
      +--value [org.apache.cassandra.cql3.Constants$Marker] 24 bytes
         |
         +--receiver [org.apache.cassandra.config.ColumnDefinition] 48 bytes
            |
            +--type [org.apache.cassandra.db.marshal.Int32Type] 16 bytes
            |  |
            |  +--reverseComparator [org.apache.cassandra.db.marshal.AbstractType$1] 16 bytes
            |
            +--name [org.apache.cassandra.cql3.ColumnIdentifier] 24 bytes
            |  |
            |  +--text [java.lang.String] 24 bytes
            |  |  |
            |  |  +--value [char[]] 24 bytes
            |  |
            |  +--bytes [java.nio.HeapByteBuffer] 48 bytes
            |     |
            |     +--hb [byte[]] 24 bytes
            |
            +--cfName [java.lang.String] 24 bytes
            |  |
            |  +--value [char[]] 32 bytes
            |
            +--ksName [java.lang.String] 24 bytes
               |
               +--value [char[]] 64 bytes

root [org.apache.cassandra.cql3.statements.Restriction[]] 16 bytes

root [java.util.HashMap] 48 bytes
   |
   +--table [java.util.HashMap$Entry[]] 16 bytes

root [java.util.HashSet] 16 bytes
   |
   +--map [java.util.HashMap] 48 bytes
      |
      +--keySet [java.util.HashMap$KeySet] 16 bytes
      |
      +--table [java.util.HashMap$Entry[]] 80 bytes
{code}  

The only elements that we should not take into account are the column types as they are singletons.
Other elements seems fine to me.

> Wrong size of cached prepared statements
> ----------------------------------------
>
>                 Key: CASSANDRA-8231
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8231
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Jaroslav Kamenik
>            Assignee: Benjamin Lerer
>         Attachments: 8231-notes.txt, Unsafes.java
>
>
> Cassandra counts memory footprint of prepared statements for caching purposes. It seems,
that there is problem with some statements, ie SelectStatement. Even simple selects is counted
as 100KB object, updates, deletes etc have few hundreds or thousands bytes. Result is that
cache - QueryProcessor.preparedStatements  - holds just fraction of statements..
> I dig a little into the code, and it seems that problem is in jamm in class MemoryMeter.
It seems that if instance contains reference to class, it counts size of whole class too.
SelectStatement references EnumSet through ResultSet.Metadata and EnumSet holds reference
to Enum class...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message