users@jersey.java.net

[Jersey] FW: Jersey 2.10.1: Jersey grizzly standalone configure outstanding async request queue size

From: nuwan abeysiriwardana <nuwan_a_at_ustocktrade.com>
Date: Sun, 25 Jan 2015 00:02:43 +0530

 

Hi All,

                My bad. Sorry for bad analysis. Rest Client that use to
create concurrent connection has a limit on max 20 per route. That the
reason.

 

Thanks

nuwan

From: nuwan abeysiriwardana [mailto:nuwan_a_at_ustocktrade.com]
Sent: Saturday, January 24, 2015 11:14 PM
To: 'users_at_jersey.java.net'
Subject: [Jersey] Jersey 2.10.1: Jersey grizzly standalone configure
outstanding async request queue size

 

Hi All,

I'm using grizzly http standalone server with jersey container. I have a
rest service which is long running for every request. Because of that I'm
using asyncResponse to improve throughput of the system. But I'm not able
run more than 20 concurrent client request at any given time. After further
investigating i found that it's not the thread pool limitation. It's more
likely request queue size limitation somewhere in the server. Because every
time rest call return I can see that worker thread reusing again for the
next rest call. Sample rest service something like this.

@Path("/boo")

    @GET

        public void asyncGet(@Suspended final AsyncResponse asyncResponse) {

            counter.incrementAndGet();

        System.out.println("counter "+counter.get()+
Thread.currentThread().getName());

            new Thread(new Runnable() {

 

                @Override

                public void run() {

                    final String result = veryExpensiveOperation();

                    asyncResponse.resume(result);

                }

 

                private String veryExpensiveOperation() {

                    // ... very expensive operation that typically finishes
within 5 seconds, simulated using sleep()

                    try {

                       Thread.sleep(5000);

                    } catch (final InterruptedException e) {

                        // ignore

                    }

                    return "DONE";

                }

            }).start();

        }

I have test client which is execute 1000 concurrent rest calls. But server
only execute rest request in 20 batches. First 20 request finished almost
same time and second 20 batch start and so on....How can i improve the
throughput of the rest request?.

Note : I have asked same question at the stackoverflow.

http://stackoverflow.com/questions/28127888/jersey-grizzly-standalone-config
ure-outstanding-async-request-queue-size

 

thanks

nuwan