how to increase rest express concurrency (for performance testing,i am using TSUNG)

131 views
Skip to first unread message

Vinayak Choubey

unread,
Apr 14, 2016, 4:05:32 AM4/14/16
to RestExpress
Hi all,
   I am a newbie in RestExpress.I have write a restexpress collector to collect the data using java program and after that i want to tuned it.For performance tuning i have used configuration file in which i have described the following:
(a) Worker thread
(b) Executor thread
   i am pasting my code snippet here which i am using for PT:

public class Echo {
    //final static Logger logger = Logger.getLogger(Echo.class.getClass());
    //static int count = 0;
    public static void main(String[] args) throws FileNotFoundException, IOException
    {
        RestExpress.setDefaultSerializationProvider(new SerializationProvider());
        CollectorConfiguration config =  Environment.load(args, CollectorConfiguration.class);
        RestExpress server = new RestExpress().setName(config.getName()).setPort(config.getPort());
        try
        {
        if (config.getWorkerCount() > 0) {
            server.setIoThreadCount(config.getWorkerCount()).bind();
        }
        if(config.getExecutorThreadCount()>=0){
            server.setExecutorThreadCount(config.getExecutorThreadCount()).bind();
        }
        }
        catch(Exception exec)
        {
            
        }
        restUri(server,config);
        mapExceptions(server);    
        server.bind();
        server.awaitShutdown();
        
    }
   

    private static void mapExceptions(RestExpress server) {
        // TODO Auto-generated method stub
        
    }

    private static void restUri(RestExpress server, CollectorConfiguration config) {

        server.uri(CollectorConfiguration.echoValue,config.getEcho()).performSerialization();
        
        //server.uri(CollectorConfiguration.echoValue_second,config.getEcho()).performSerialization();
        //System.out.println("Request complete");
    }  

Kindly tell me the proper way of tuning the RESTEXPRESS and how to tuned it why because my concurrency is reaching for 5000 users only.i want to achieve it more.

Todd Fredrich

unread,
Aug 3, 2016, 4:22:26 PM8/3/16
to RestExpress
A slight comment before I attempt to answer your question: I see a couple of extraneous calls to bind() in the main() method. You may have better results if server.bind() is only called right before awaitShutdown(). Also, the default is to performSerialization() so you wouldn't need to specify that--although it's OK to be explicit. :)

You mention your only reaching concurrency of 5,000. The question is how are you testing it. Many times the load tool is actually loading up. For example ApacheBench (ab) has issues. JMeter mostly works, but you can still have problems spinning up so many threads. Especially if the testing tool is on the same box with the service.

Also, if you're concerned about concurrency for only an echo, then you don't need the background executor threads--there's some overhead in the message passing between the front-end I/O worker threads and the back-end executor threads. However, that's probably not real world.  The only thing blocking is the serialization, so in this case you don't need the back-end executors (you can set them to 0).

Other than that, it matters whether your using connection keep-alive or not and how many ephemeral ports are available (ulimit on *nix machines).

There's a tuning article here: https://github.com/RestExpress/RestExpress/wiki/Thread-Pool-and-I-O-Flow among some other pages on the RestExpress wiki there that may be of interest to you (for example: https://github.com/RestExpress/RestExpress/wiki/Benchmarks)

Enjoy,
--Todd
Reply all
Reply to author
Forward
0 new messages