I'm seeing some pretty bad performance which I suspect can be pinned on
SocketServer. What is strange here is that the transaction rate I'm
seeing is identical regardless of the number and disposition of the
parameters passed/returned. It's always 12.5/sec, 80ms per operation.

I've attached a trivial example that replicates what I am seeing on
Linux w/ OpenJDK 1.6

I'm happy to open a bug report, I just wanted to ping the list first to
see if this is known issue or rings any bells.

Thanks,

-- 
Eric Evans
[email protected]
{
 "namespace": "test.proto",
 "protocol": "Echo",

 "messages": {
     "echo": {
         "request": [{"name": "message", "type": "string"}],
         "response": "string"
     }
 }
}
package test;

import test.proto.Echo;
import org.apache.avro.ipc.SocketServer;
import org.apache.avro.ipc.SocketTransceiver;
import org.apache.avro.specific.SpecificRequestor;
import org.apache.avro.specific.SpecificResponder;
import org.apache.avro.util.Utf8;
import java.io.IOException;
import java.net.InetSocketAddress;

public class EchoMain {
    public static class EchoServer implements Echo {
        public Utf8 echo(Utf8 message) {
            return message;
        }
      }

    private static SocketServer server;

    private static void listen() throws IOException {
        server = new SocketServer(new SpecificResponder(
                Echo.class, new EchoServer()), new InetSocketAddress(0));
    }

    public static void main(String[] args) throws IOException {
        int runs = 1000;
        if (args.length > 1)
            runs = Integer.parseInt(args[0]);

        // Server
        listen();

        // Client
        SocketTransceiver client =
            new SocketTransceiver(new InetSocketAddress(server.getPort()));
        Echo proxy = (Echo)SpecificRequestor.getClient(Echo.class, client);

        Utf8 echoed, message = new Utf8("ping");
        int count = 0;
        long start = System.currentTimeMillis();

        for (int i = 0; i < runs; i++)
        {
            echoed = proxy.echo(message);
            assert(echoed.equals(message));
            count++;
        }

        long end = System.currentTimeMillis();

        System.out.println(count + " ops in " + (end-start)/1000 + " secs");

        // cleanup
        client.close();
        server.close();
    }
}

Reply via email to