I tried on both mac OS 10.6.8 and Ubuntu 11.04 with thrift 0.6.1.

Thanks,



________________________________
From: Bryan Duxbury <br...@rapleaf.com>
To: user@thrift.apache.org
Sent: Wed, November 16, 2011 11:52:57 AM
Subject: Re: 100% CPU usage with Java TNonBlockingServer and THsHaServer

Hm, I definitely have not seen an unloaded server using 100% cpu. What
environment are you running in?

On Wed, Nov 16, 2011 at 10:32 AM, Kanzhe Jiang <kji...@yahoo.com> wrote:

> 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

Reply via email to