Re: [javagroups-users] Does jgroups create too many objects when sending ?
Brought to you by:
belaban
From: Bela B. <be...@ya...> - 2005-11-21 08:30:10
|
I suggest you implement your own marshalling / unmarshalling for ReplicatedCacheMessage, and give the resulting byte[] buffer to JGroups rather than the object. Obviously you can't avoid using serialization for keys and values, but ReplicatedCacheMessage doesn't need to use it. Sergio Oliveira wrote: > Hi List, > > This is my first post to the list. > > I am implementing a fully replicated cache with JGroups. > > I am wondering what happens behind the scenes when I do this: > > protected synchronized Object put(Object key, Object value, > boolean send) { > Object obj = cache.put(key, value); > if (send) { > try { > ReplicatedCacheMessage msg = new > ReplicatedCacheMessage( ReplicatedCacheMessage.PUT, > (java.io.Serializable) key, (java.io.Serializable) value); > channel.send(null, null, msg); > } catch(Exception e) { > e.printStackTrace(); > } > } > return obj; > } > > I am probably creating too many objects here and the GC will go nuts > under heavy loads. > > I should probably create a ByteBuffer or a pool of objects, however I > must know wheter channel.send is asynchronous or not, meaning, when > channel.send() returns, am I free to use the message object again > right away ? > > Have anyone here developed a session replication mechanism for a big > website with many machines in load balance ? > > Sergio -- Bela Ban Lead JGroups / JBossCache callto://belaban |