Dear,<br>
My command test:<br>
In my test, I start memcached with memcached -m 1024 =&gt;1G to prevent miss cache<br>
and infinispan with param:-Xmx1G <br>
<br>
Monitor java memory used:<br>
I use ubuntu and I see the memory column from &quot;System Monitor(in Ubuntu) for Infinispan.<br>
<br>
In my test code, I only put once time for one key ( that mean no version for data)<br>
You can see my code test by put to memcached and infinispan with the same code(only change port):<br>
import java.io.ByteArrayInputStream;<br>
import java.io.DataInputStream;<br>
import java.io.IOException;<br>
import java.net.InetSocketAddress;<br>
<br>
import net.spy.memcached.
<blockquote class="gmail_quote">MemcachedClient;<br><br>/**<div class="im"><br> * /usr/bin/memcached -m 1024 -u nobody -p 11211 -l 127.0.0.1<br></div><div class="im">
 * ./startServer.sh -r memcached -p 4567<br></div> * @author root<br> */<br>public class ServerDemo {<br><br>    private static final String HOST = &quot;localhost&quot;;<br>//    private static final int PORT = 4567;//inf<br>
    private static final int PORT = 11211;//mem<br>
    private static final int TOTAL_PUT = 500000;<br>    private static final int DATA_LENGTH = 1000;<br><br><br>    public static void main(String[] args) throws Exception {<br>        Thread t = new Thread() {<br><br>            @Override<br>

            public void run() {<br>                try {<br>                    long beginTime = System.currentTimeMillis();<br>                    put(TOTAL_PUT, DATA_LENGTH);<br>                    long endTime = System.currentTimeMillis() - beginTime;<br>

                    System.out.println(&quot;cost = &quot; + endTime);<br>                    System.gc();<br>                } catch (Exception e) {<br>                }<br><br>            }<br>        };<br>        t.start();<br>

    }<br><br>    private static String getStringByLength(int size) {<br>        String s = &quot;&quot;;<br>        for (int i = 0; i &lt; size; i++) {<br>            s += &quot;1&quot;;<br>        }<br>        return s;<br>

    }<br><br>    private static CommentItem getCommentInstance(String content) {<br>        int time = new Long(System.currentTimeMillis()).intValue();<br>        CommentItem commentItem = new CommentItem(new Long(123), 12345, 456, time, content.getBytes(), (byte) 1);<br>

        return commentItem;<br>    }<br><br>    private static byte[] comment2Bytes(CommentItem commentItem) throws Exception {<br>        DataOutputBuffer dos = new DataOutputBuffer();<br>        CommentItemSerializer.getInstance().serialize(commentItem, dos);<br>

        System.out.println(&quot;dos.getData()=&quot; + dos.getData().length);<br>        return dos.getData();<br>    }<br><br>    private static void putComment2Cached(int keyPrefix, byte[] bytes, MemcachedClient mcc) throws Exception {<br>

        mcc.set(&quot;node_&quot; + keyPrefix, 3600, bytes);<br>        byte[] result = (byte[]) mcc.get(&quot;node_&quot; + keyPrefix);<br>        DataInputStream stream = new DataInputStream(new ByteArrayInputStream(<br>

                result));<br>        CommentItem getBackItem = CommentItemSerializer.getInstance().deserialize(stream);<br>//        if (!commentItem.equals(getBackItem)) {<br>//            System.out.println(&quot;fail i= node_&quot; + keyPrefix);<br>

//        }<br>    }<br><br>    private static void put(int loop, int size) throws IOException, Exception {<br>        MemcachedClient mcc = new MemcachedClient(new InetSocketAddress(HOST, PORT));<br>        String testData = getStringByLength(size);<br>

        CommentItem commentItem = getCommentInstance(testData);<br>        byte[] bytes = comment2Bytes(commentItem);<br>        for (int i = 0; i &lt; loop; i++) {<br>            putComment2Cached(i, bytes, mcc);<br>        }<br>

    }<br>}</blockquote>
<br>
<br>
<br><br>2011/3/10 Nguyễn Hồng Nhựt <span dir="ltr">&lt;<a href="mailto:nhutnguyenhong@gmail.com">nhutnguyenhong@gmail.com</a>&gt;</span><br>Dear,<br>I use ubuntu and I see the memory column from &quot;System Monitor(in Ubuntu) for Infinispan.<br>
In my test code, I only put once time and get it back to see I put ok.<br>You can see my code test by put to memcached and infinispan with the same code(only change port):<br>
<br><br><br>import java.io.ByteArrayInputStream;<br>import java.io.DataInputStream;<br>import java.io.IOException;<br>import java.net.InetSocketAddress;<br><br>import net.spy.memcached.<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
MemcachedClient;<br><br>/**<div class="im"><br> * /usr/bin/memcached -m 1024 -u nobody -p 11211 -l 127.0.0.1<br></div><div class="im">
 * ./startServer.sh -r memcached -p 4567<br></div> * @author root<br> */<br>public class ServerDemo {<br><br>    private static final String HOST = &quot;localhost&quot;;<br>//    private static final int PORT = 4567;//inf<br>
    private static final int PORT = 11211;//mem<br>
    private static final int TOTAL_PUT = 500000;<br>    private static final int DATA_LENGTH = 1000;<br><br><br>    public static void main(String[] args) throws Exception {<br>        Thread t = new Thread() {<br><br>            @Override<br>

            public void run() {<br>                try {<br>                    long beginTime = System.currentTimeMillis();<br>                    put(TOTAL_PUT, DATA_LENGTH);<br>                    long endTime = System.currentTimeMillis() - beginTime;<br>

                    System.out.println(&quot;cost = &quot; + endTime);<br>                    System.gc();<br>                } catch (Exception e) {<br>                }<br><br>            }<br>        };<br>        t.start();<br>

    }<br><br>    private static String getStringByLength(int size) {<br>        String s = &quot;&quot;;<br>        for (int i = 0; i &lt; size; i++) {<br>            s += &quot;1&quot;;<br>        }<br>        return s;<br>

    }<br><br>    private static CommentItem getCommentInstance(String content) {<br>        int time = new Long(System.currentTimeMillis()).intValue();<br>        CommentItem commentItem = new CommentItem(new Long(123), 12345, 456, time, content.getBytes(), (byte) 1);<br>

        return commentItem;<br>    }<br><br>    private static byte[] comment2Bytes(CommentItem commentItem) throws Exception {<br>        DataOutputBuffer dos = new DataOutputBuffer();<br>        CommentItemSerializer.getInstance().serialize(commentItem, dos);<br>

        System.out.println(&quot;dos.getData()=&quot; + dos.getData().length);<br>        return dos.getData();<br>    }<br><br>    private static void putComment2Cached(int keyPrefix, byte[] bytes, MemcachedClient mcc) throws Exception {<br>

        mcc.set(&quot;node_&quot; + keyPrefix, 3600, bytes);<br>        byte[] result = (byte[]) mcc.get(&quot;node_&quot; + keyPrefix);<br>        DataInputStream stream = new DataInputStream(new ByteArrayInputStream(<br>

                result));<br>        CommentItem getBackItem = CommentItemSerializer.getInstance().deserialize(stream);<br>//        if (!commentItem.equals(getBackItem)) {<br>//            System.out.println(&quot;fail i= node_&quot; + keyPrefix);<br>

//        }<br>    }<br><br>    private static void put(int loop, int size) throws IOException, Exception {<br>        MemcachedClient mcc = new MemcachedClient(new InetSocketAddress(HOST, PORT));<br>        String testData = getStringByLength(size);<br>

        CommentItem commentItem = getCommentInstance(testData);<br>        byte[] bytes = comment2Bytes(commentItem);<br>        for (int i = 0; i &lt; loop; i++) {<br>            putComment2Cached(i, bytes, mcc);<br>        }<br>

    }<br>}<br></blockquote><br><br><div class="gmail_quote">2011/3/10 Nguyễn Hồng Nhựt <span dir="ltr">&lt;<a href="mailto:nhutnguyenhong@gmail.com">nhutnguyenhong@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5"><br><div>Hi Infinispan Devs,</div>I used memcached all time. I am research Infinispan and make a compare with memcached.</div></div><div><div><div></div><div class="h5">I have just make a memory test between memcached and infinispan to choose which one better(best memory saved).<div>


<br></div><div>I run Infinispan from command line: ./startServer.sh -r 
memcached -p 4567 ( I am fresh download and run it with no custom any 
config file)</div><div>and also memcached from command line: /usr/bin/memcached -m 1024 -u nobody -p 11211 -l 127.0.0.1</div>
<div><br></div><div>with testcase 10000 key and every key has value is byte array  with length= 1024</div><div>
Infinispan : =&gt; memory: 58MB</div><div>Memcached: =&gt; memory: 14MB</div><div><br></div><div><div>with testcase 500000 key and every key  has value is byte array  with length= 1024</div>
<div>Infinispan : =&gt; memory: 920MB</div><div>Memcached: =&gt; memory: 565MB</div></div>
<div><br><br></div></div></div><div>In Infinispan, any config param familiar with memory cost? and how i can reduce this cost? why they have a big difference?<br></div><div><br></div><div>thanks and best regards.</div>
<div><br></div></div>
</blockquote></div><br>