Note that there are some explanatory texts on larger screens.

plurals
  1. POKryonet RMI performance
    primarykey
    data
    text
    <p>I was trying to run a performance test for Kryonet RMI, the test results are not convincing. However I think I may not be doing things in the right way. Can I get some feedback on the code below.</p> <h3>SERVER</h3> <pre><code>import com.esotericsoftware.kryo.Kryo; import com.esotericsoftware.kryonet.Connection; import com.esotericsoftware.kryonet.Listener; import com.esotericsoftware.kryonet.Server; import com.esotericsoftware.kryonet.rmi.ObjectSpace; public class Razor { static int port = 2551; static String send = null; // Data Creator, creates data of size s.getBytes().length * 10 static String createMsg(String s){ StringBuilder sb = new StringBuilder(); for (int i = 0 ; i &lt; 10; i++){ sb.append(s); } System.out.println(sb.toString().getBytes().length); return sb.toString(); } // Test Interface public static interface TestInterface { public String getName (String name); } //Class implementing the test interface. static private class TestImpl implements TestInterface { public String getName (String name) { return send; } } public static void main (String[] args) throws Exception { // Creating data of size 160 bytes send = createMsg("FooAndBarAndLazy"); Server server = new Server(); Kryo kryo = server.getKryo(); ObjectSpace.registerClasses(kryo); kryo.register(TestInterface.class); server.start(); server.bind(port); System.out.println("Server started on " + port); TestImpl test = new TestImpl(); final ObjectSpace objectSpace = new ObjectSpace(); objectSpace.register(123, test); server.addListener(new Listener() { public void connected (final Connection connection) { objectSpace.addConnection(connection); } }); } } </code></pre> <h3>CLIENT</h3> <pre><code>import com.esotericsoftware.kryo.Kryo; import com.esotericsoftware.kryonet.Client; import com.esotericsoftware.kryonet.rmi.ObjectSpace; public class TBone { static int port = 2551; // Bytes to MB converter public static float b2mb(long bytes){ float bb = bytes; float ll = 1024 * 1024; return bb/ll; } // Nono Seconds to seconds converter public static float ns2s(long nsecs){ float f = nsecs; float t = 1000000000; return f/t; } public static void main (String[] args) throws Exception { Client client = new Client(); Kryo kryo = client.getKryo(); ObjectSpace.registerClasses(kryo); kryo.register(Razor.TestInterface.class); client.start(); client.connect(50000, "localhost", port); Razor.TestInterface test = ObjectSpace.getRemoteObject(client, 123, Razor.TestInterface.class); String profile = null; int bytes = 0; long stime = System.nanoTime(); for (int i = 0; i &lt; 1000; i++){ profile = test.getName(""); bytes = bytes + profile.getBytes().length; if (i %100 == 0) System.out.println("Done : " + i); } long etime = System.nanoTime(); System.out.println("Total bytes(MB) : " + b2mb(bytes)+" , " + "Total time : " + ns2s((etime-stime))+" seconds"); client.stop(); } } </code></pre> <h3>RESULT</h3> <pre><code>Done : 0 Done : 100 Done : 200 Done : 300 Done : 400 Done : 500 Done : 600 Done : 700 Done : 800 Done : 900 Total bytes(MB) : 0.15258789 , Total time : 26.139627 seconds </code></pre> <p>I would imagine way more performance. Is this a valid test? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload