Does compression work for Externalizable?

36 views
Skip to first unread message

Si Rakov

unread,
Oct 21, 2021, 1:40:07 PM10/21/21
to Hazelcast
Hi,

Thanks for your help on my earlier question.  I found the config, and turned compression on.

However, I am not seeing any change in the size of the map, either with or without compression.  Should I be seeing a change?  We use java.io.Externalizable for our serialization.  Does compression work with that?

Thanks for your help!

yours
Si Rakov

M. Sancar Koyunlu

unread,
Oct 25, 2021, 5:30:34 AM10/25/21
to Hazelcast
Yes, the compression should work for java.io.Externalizable as well. 

See the following test:
Note that I am using the private API here. It is not to be used on production but just to show that it works. 
public static class Test implements Externalizable {

private long a;
private long b;
private long c;
private long d;

@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeLong(a);
out.writeLong(b);
out.writeLong(c);
out.writeLong(d);
}

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
a = in.readLong();
b = in.readLong();
c = in.readLong();
d = in.readLong();
}
}

public static void main(String[] args) throws InterruptedException {

{

SerializationConfig serializationConfig = new SerializationConfig();
serializationConfig.setEnableCompression(true);
SerializationService serializationService = new DefaultSerializationServiceBuilder().setConfig(serializationConfig).build();
System.out.println("COMPRESSED SIZE " + serializationService.toData(new Test()).totalSize());
}

{
SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
System.out.println("DEFAULT SIZE " + serializationService.toData(new Test()).totalSize());
}
}

Note that I am using a private API. This API should not be used on production. 
--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/99dd0c3b-1280-43f3-9b29-7090f5236384n%40googlegroups.com.


--

Sancar Koyunlu

Software Engineer

san...@hazelcast.com

Hazelcast

2 W 5th Ave, Ste 300 | San Mateo, CA 94402 | USA

+1 (650) 521-5453 | hazelcast.com


This message contains confidential information and is intended only for the individuals named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required, please request a hard-copy version. -Hazelcast

Si Rakov

unread,
Oct 25, 2021, 4:06:36 PM10/25/21
to haze...@googlegroups.com, san...@hazelcast.com
Hi Sancar,

Thank you so much.  Can you explain the following?  

  1. When I enable compression, then log into my application without compression, I see the Hazelcast Management Center (HMC) showing a specific size committed to the map.  When I turn on compression and do the same thing, I see the same size committed to the map.  Do you know why this might be?  
  2. Is the HMC showing the actual size of the map in both cases, or the decompressed size?  
  3. If it is the decompressed size, how do I view the compressed size in the HMC?

Thanks for your help!

best
Simon Rakov

You received this message because you are subscribed to a topic in the Google Groups "Hazelcast" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hazelcast/eHriHWY8hek/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hazelcast+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/CAEj0St9UieqU0h%3DJLrtBB1KiCRd94dxS%3DRLGJ6QygM_yND_Qsg%40mail.gmail.com.

Si Rakov

unread,
Oct 25, 2021, 4:08:59 PM10/25/21
to haze...@googlegroups.com
Let me amend the last message, because it was confusing.  Here are the cases:

a. Bring up HMC with compression disabled
b. Log into webapp that uses Hazelcast
c. View size of map
d. Logout
e. Restart HMC with compression enabled
f. Repeat (b)
g. Repeat (c)
h.  The size of the map at c and g are the same.  Why is this?

Thanks
Simon

M. Sancar Koyunlu

unread,
Oct 26, 2021, 10:30:03 AM10/26/21
to Hazelcast
I did try with management center 5.0 and hazelcast 5.0

What do you mean by size exactly ? See the following screen shots where I run the member with compression on and off.
Screenshot from 2021-10-26 17-11-33.png
Screenshot from 2021-10-26 17-13-05.png
 I can see that EntryMemory is changing between the two runs 

After I write this message I read your message again and realize that there is a problem with step "e"

The compression should be enabled on the member/client which will load the data. The configuration of the ManagementCenter is not relevant. 

Si Rakov

unread,
Nov 4, 2021, 11:31:09 AM11/4/21
to Hazelcast
Hi,

I could see that the members were configured for compression.  I have been told that compression does not work at all in version 4, which is what I have been using.  Is this true?

Thanks
Si

M. Sancar Koyunlu

unread,
Nov 4, 2021, 12:04:08 PM11/4/21
to haze...@googlegroups.com
It should work with 4.0 as well. 

M. Sancar Koyunlu

unread,
Nov 5, 2021, 3:47:42 AM11/5/21
to haze...@googlegroups.com
Hi again, 

I have tried with 4.2 members and 4.2 management center to make sure. I see the exact same memory sizes and effect of the compression as I shared in the previous email. 

Where are you loading the data from ? Client / Member / SQL interface ?
Can you share your hazelcast config of your members or clients if you have any ? 
Also you may share the screenshots of the management center for us to double check ? 


Reply all
Reply to author
Forward
0 new messages