[jboss-jira] [JBoss JIRA] (JGRP-2127) UnicastHeader3: reduce in-memory size

Bela Ban (JIRA) issues at jboss.org
Thu Nov 10 06:01:00 EST 2016


     [ https://issues.jboss.org/browse/JGRP-2127?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bela Ban updated JGRP-2127:
---------------------------
    Labels: Beta3  (was: )


> UnicastHeader3: reduce in-memory size
> -------------------------------------
>
>                 Key: JGRP-2127
>                 URL: https://issues.jboss.org/browse/JGRP-2127
>             Project: JGroups
>          Issue Type: Enhancement
>            Reporter: Bela Ban
>            Assignee: Bela Ban
>            Priority: Minor
>              Labels: Beta3
>             Fix For: 4.0
>
>
> JOL reports:
> {noformat}
> org.jgroups.protocols.UnicastHeader3 object internals:
>  OFFSET  SIZE    TYPE DESCRIPTION                    VALUE
>       0     4         (object header)                01 00 00 00 (00000001 00000000 00000000 00000000) (1)
>       4     4         (object header)                00 00 00 00 (00000000 00000000 00000000 00000000) (0)
>       8     4         (object header)                9d 11 01 f8 (10011101 00010001 00000001 11111000) (-134147683)
>      12     2   short Header.prot_id                 0
>      14     2         (alignment/padding gap)        N/A
>      16     8    long UnicastHeader3.seqno           0
>      24     8    long UnicastHeader3.timestamp       0
>      32     2   short UnicastHeader3.conn_id         0
>      34     1    byte UnicastHeader3.type            0
>      35     1 boolean UnicastHeader3.first           false
>      36     4         (loss due to the next object alignment)
> Instance size: 40 bytes
> Space losses: 2 bytes internal + 4 bytes external = 6 bytes total
> {noformat}
> We could reduce the size to 32 by making {{timestamp}} an int. This field is used for comparison against previous timestamps, and since the comparison takes numeric overflow into account, wrap-around is not a problem.
> After the change of {{timestamp}} from {{long}} -> {{int}}:
> {noformat}
> org.jgroups.protocols.UnicastHeader3 object internals:
>  OFFSET  SIZE    TYPE DESCRIPTION                    VALUE
>       0     4         (object header)                01 00 00 00 (00000001 00000000 00000000 00000000) (1)
>       4     4         (object header)                00 00 00 00 (00000000 00000000 00000000 00000000) (0)
>       8     4         (object header)                9d 11 01 f8 (10011101 00010001 00000001 11111000) (-134147683)
>      12     2   short Header.prot_id                 0
>      14     2         (alignment/padding gap)        N/A
>      16     8    long UnicastHeader3.seqno           0
>      24     4     int UnicastHeader3.timestamp       0
>      28     2   short UnicastHeader3.conn_id         0
>      30     1    byte UnicastHeader3.type            0
>      31     1 boolean UnicastHeader3.first           false
> Instance size: 32 bytes
> Space losses: 2 bytes internal + 0 bytes external = 2 bytes total
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list