thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kanzhe Jiang <kji...@yahoo.com>
Subject 100% CPU usage with Java TNonBlockingServer and THsHaServer
Date Wed, 16 Nov 2011 18:32:53 GMT
I wrote a simple packetstreamer thrift server with NBlocking and THsHa server.
The server takes 100% CPU usage in top even when no client is present.

Here is how the server is instantiated:

    public static void simple(PacketStreamer.Processor processor) {
        try {    
            // Use this for a multithreaded server
            TNonblockingServerTransport serverTransport = new 
TNonblockingServerSocket(port);
            TNonblockingServer.Args args = new 
TNonblockingServer.Args(serverTransport);
            //THsHaServer.Args args = new THsHaServer.Args(serverTransport);
            args.processor(processor);
            args.transportFactory(new TFramedTransport.Factory());
            args.protocolFactory(new TBinaryProtocol.Factory(true, true));
            //TServer server = new TThreadPoolServer(args);
            TServer server = new TNonblockingServer(args);
            //TServer server = new THsHaServer(args);
                
            log.debug("Starting the packetstreamer server on port {} ...", 
port);
            server.serve();
        } catch (Exception e) {
            e.printStackTrace();
        }       
    }       

The JConsole profiler showed at least the poller thread with increasing cputime.
The point of using NonBlockingServer is to be graceful with CPU.

Any help is greatly appreciated!
Thanks,
Kanzhe
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message