You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sergey Beryozkin <sb...@gmail.com> on 2012/04/05 15:04:31 UTC

Re: CXF Test client for JAXB load testing

Hi Kiren

sorry for a delay, here is the output from the test program on my laptop:

pool-1-thread-1 awaiting
pool-1-thread-2 awaiting
pool-1-thread-3 awaiting
pool-1-thread-4 awaiting
pool-1-thread-5 awaiting
pool-1-thread-6 awaiting
pool-1-thread-7 awaiting
pool-1-thread-8 awaiting
pool-1-thread-9 awaiting
pool-1-thread-10 awaiting
pool-1-thread-10 started
pool-1-thread-1 started
pool-1-thread-2 started
pool-1-thread-5 started
pool-1-thread-4 started
pool-1-thread-9 started
pool-1-thread-3 started
pool-1-thread-8 started
pool-1-thread-7 started
pool-1-thread-6 started
pool-1-thread-5done
pool-1-thread-8done
pool-1-thread-4done
pool-1-thread-10done
pool-1-thread-3done
pool-1-thread-6done
pool-1-thread-1done
pool-1-thread-2done
pool-1-thread-7done
pool-1-thread-9done
Average exec time ... 36
No Users:10
NO_REQUESTS_PER_USER100

Was 44 originally, then between 39-36

Not too bad I guess given that we have 10 threads executing 100 requests 
simultaneously with JAXB marshalling/unmarshalling involved :-)

I tried 2.6.0-SNAPSHOT. I'm getting convinced CXF is performing pretty 
well indeed :-), there could be a lot of other factors though affecting 
the actual performance data

Cheers, Sergey

On 28/03/12 18:59, Kiren Pillay wrote:
> Hi Sergey!
>
> I've taken your multi-threaded project and modified it so that each thread
> sends a specific number of requests. What I am seeing is that the average
> time  is 100ms. Can you please confirm if this is correct? All my cores go
> to 100% when I run this.
>
> Note that the Response object is our own xml Response object, and not the
> CXF one.
>
> Regards
> Kiren
>
> package za.co.kiren.load;
>
> import java.util.concurrent.ArrayBlockingQueue;
> import java.util.concurrent.CountDownLatch;
> import java.util.concurrent.ThreadPoolExecutor;
> import java.util.concurrent.TimeUnit;
> import java.util.concurrent.atomic.AtomicLong;
>
> import javax.ws.rs.core.MediaType;
>
> import org.apache.cxf.jaxrs.client.WebClient;
>
> import za.co.xxx.pams.messaging.response.Response;
>
> public class MultiUserLoadTest {
>
>      private static final int NO_USERS = 10;
>      private static final int NO_REQUESTS_PER_USER = 1000/NO_USERS;
>
>      public static void main(String[] args) throws InterruptedException {
>
>            AtomicLong totalTime=new AtomicLong();
>
>              ThreadPoolExecutor executor = new ThreadPoolExecutor(NO_USERS,
> NO_USERS, 0,
>                      TimeUnit.SECONDS, new
> ArrayBlockingQueue<Runnable>(NO_USERS));
>              CountDownLatch startSignal = new CountDownLatch(1);
>              CountDownLatch doneSignal = new CountDownLatch(NO_USERS);
>
>              for (int j = 0; j<  NO_USERS; j++) {
>                  executor.execute(new MultiUserLoadTest().new
> Worker(totalTime,
>                          startSignal, doneSignal));
>              }
>              startSignal.countDown();
>              doneSignal.await(120, TimeUnit.SECONDS);
>              executor.shutdownNow();
>              if (doneSignal.getCount() != 0) {
>                  throw new RuntimeException("Not all threads done, must have
> timed out?");
>              }
>
>              System.out.println("Average exec time ... " +
> totalTime.intValue()
>                      / (NO_USERS*NO_REQUESTS_PER_USER));
>
>              System.out.println("No Users:"+NO_USERS);
>              System.out.println("NO_REQUESTS_PER_USER"+NO_REQUESTS_PER_USER);
>
>      }
>
>      class Worker implements Runnable {
>          private final AtomicLong total;
>          private CountDownLatch startSignal;
>          private CountDownLatch doneSignal;
>          private int count=0;
>          private String threadName;
>
>          public Worker(AtomicLong total, CountDownLatch startSignal,
>                  CountDownLatch doneSignal) {
>              this.total = total;
>              this.startSignal = startSignal;
>              this.doneSignal = doneSignal;
>          }
>
>          @Override
>          public void run() {
>              threadName=Thread.currentThread().getName();
>              try {
>                  System.out.println(Thread.currentThread().getName()+"
> awaiting");
>                  startSignal.await();
>                  System.out.println(Thread.currentThread().getName()+"
> started");
>
>                  WebClient wc = WebClient.create(
>                          "http://localhost:8080/RestTest/rest/test/xml",
>                          "user", "passwordt", null);
>                  wc.accept(MediaType.TEXT_XML);
>
>                  for (int i = 0; i<  NO_REQUESTS_PER_USER; i++) {
>                  count++;
>              /*    wc.replaceQueryParam("batchNumber",
>                          ((int) (1000 + Math.random() * 100)));*/
>                  long l1 = System.currentTimeMillis();
>                  Response response = wc.get(Response.class);
>
>                  long l2 = System.currentTimeMillis();
>
>                  total.getAndAdd(l2 - l1);
>                  }
>
>                  doneSignal.countDown();
>                  System.out.println(Thread.currentThread().getName()+"
> done");
>
>              } catch (Exception ex) {
>                  System.err.println(threadName+" "+ex.getMessage());
>              ;
>                  throw new RuntimeException();
>              }
>          }
>
>      }
>
>
>
> }
>
>
> On Wed, Mar 28, 2012 at 12:20 PM, Sergey Beryozkin<sb...@gmail.com>wrote:
>
>> Hi Kiren
>>
>> On 28/03/12 10:33, Kiren Pillay wrote:
>>
>>> Hi Sergey!
>>>
>>> With your code I'm getting 13 ms average on my Tomcat server and  34ms on
>>> Jetty maven plugin (I was actually expecting the opposite).
>>>
>>> Against the String response url I'm getting 4ms on Tomcat  and 5ms on
>>> Jetty.
>>>
>>> I think now we're getting down to the level of differences in the quality
>>> of our hardware, I've got an intel I5  (M 430  @ 2.27GHz) laptop with
>>> plenty of RAM, you probably have a better machine. I'm running Java 7
>>> update 3 on a linux 64bit Ubuntu 11.10  machine.
>>>
>>>   I have I7 with few processors and plenty of memory, so that can explain
>> some difference. Java6&  Ubuntu 11.04. Please try CXF 2.5.3-SNAPSHOT, that
>> might help with saving few milliseconds too plus in case of JAXB - save on
>> the pretty-printing 'expenses' which you already verified.
>>
>> What I think is that the server runtime is performing pretty well, the
>> client runtimes have different qualities though and that can affect the
>> performance measurements...
>>
>> Wonder how would JIXB perform :-)
>>
>> Cheers, Sergey
>>
>>   Regards
>>> Kiren
>>>
>>> On Tue, Mar 27, 2012 at 11:04 PM, Sergey Beryozkin<sberyozkin@gmail.com**
>>>> wrote:
>>>
>>>   Hi Kiren
>>>>
>>>> On 27/03/12 13:09, Kiren Pillay wrote:
>>>>
>>>>   Hi Sergey,
>>>>>
>>>>> Attached is a war file against which I am testing my client.
>>>>>
>>>>>   great, thanks
>>>>
>>>>
>>>>   The test URLS
>>>>
>>>>> are given below together with the Jamon stats for a 1000 hits.
>>>>>
>>>>>
>>>>> 1. Large response (27k)
>>>>>
>>>>> url="http://localhost:8080/****RestTest/rest/test/long/27000<http://localhost:8080/**RestTest/rest/test/long/27000>
>>>>> <**http://localhost:8080/**RestTest/rest/test/long/27000<http://localhost:8080/RestTest/rest/test/long/27000>
>>>>>>
>>>>> "**;
>>>>>
>>>>> JAMon Label=myCodeTimer, Units=ms.: (Hits=1000.0, Avg=7.77,
>>>>> Total=7770.0,
>>>>> Min=4.0
>>>>> tps:128.5512276642242
>>>>>
>>>>> 2. Small response
>>>>>
>>>>> url="http://localhost:8080/****RestTest/rest/test/short<http://localhost:8080/**RestTest/rest/test/short>
>>>>> <http:**//localhost:8080/RestTest/**rest/test/short<http://localhost:8080/RestTest/rest/test/short>
>>>>>>
>>>>>
>>>>> ";
>>>>> JAMon Label=myCodeTimer, Units=ms.: (Hits=1000.0, Avg=5.454,
>>>>> Total=5454.0,
>>>>> Min=3.0, Max=37.0
>>>>> tps:183.0831197363603
>>>>>
>>>>> 3. Dummy Response using the JAXB schema
>>>>>
>>>>> url="http://localhost:8080/****RestTest/rest/test/xml<http://localhost:8080/**RestTest/rest/test/xml>
>>>>> <http://**localhost:8080/RestTest/rest/**test/xml<http://localhost:8080/RestTest/rest/test/xml>
>>>>>>
>>>>>
>>>>> ";
>>>>> JAMon Label=myCodeTimer, Units=ms.: (Hits=1000.0, Avg=15.381,
>>>>> Total=15381.0,
>>>>> Min=9.0, Max=542.0,
>>>>> tps:64.96037417175522
>>>>>
>>>>>
>>>>>   With the following code:
>>>>
>>>> WebClient wc = WebClient.create("http://****
>>>> localhost:8080/RestTest/rest/****
>>>> test/xml<http://localhost:**8080/RestTest/rest/test/xml<http://localhost:8080/RestTest/rest/test/xml>
>>>>> ")**;
>>>>
>>>>         wc.accept("text/xml");
>>>>         // warm up a bit
>>>>         for (int i = 0; i<   50; i++) {
>>>>             wc.get();
>>>>         }
>>>>
>>>>         long total = 0;
>>>>         for (int i = 0; i<   1000; i++) {
>>>>             long l1 = System.currentTimeMillis();
>>>>                 wc.get(Document.class);
>>>>             long l2 = System.currentTimeMillis();
>>>>
>>>>                 total += l2-l1;
>>>>         }
>>>>         System.out.println("Average: " + total/1000);
>>>>
>>>> I'm getting 10 millisecs average. Note I'm adding a Document reading just
>>>> to eliminate any optimizations with webClient.get() where no actual read
>>>> is
>>>> done.
>>>>
>>>> Running the same code against
>>>> http://localhost:8080/****RestTest/rest/test/long/27000<http://localhost:8080/**RestTest/rest/test/long/27000>
>>>> <**http://localhost:8080/**RestTest/rest/test/long/27000<http://localhost:8080/RestTest/rest/test/long/27000>
>>>>>
>>>>
>>>>
>>>> (changing address, accept to text/plain, and wc.get(Document.class); to
>>>> wc.get(String.class);)
>>>>
>>>> gives me 2 milliseconds average.
>>>>
>>>>
>>>> Can you try the same code please ?
>>>>
>>>> Cheers, Sergey
>>>>
>>>>
>>>>   I've include our custom JAXB-enabled schema jar, the rest you can build
>>>>
>>>>> from
>>>>> maven pom.xml.
>>>>>
>>>>> http://cxf.547215.n5.nabble.****com/file/n5597650/****
>>>>> RestWarProject.tar.gz<http://**cxf.547215.n5.nabble.com/file/**
>>>>> n5597650/RestWarProject.tar.gz<http://cxf.547215.n5.nabble.com/file/n5597650/RestWarProject.tar.gz>
>>>>> **>
>>>>>
>>>>> RestWarProject.tar.gz
>>>>>
>>>>> Custom JAXB schema file:
>>>>>
>>>>> http://cxf.547215.n5.nabble.****com/file/n5597650/pams-core-**
>>>>> xsd-server-1.3.0_ba_nemo-****SNAPSHOT.jar<http://cxf.**
>>>>> 547215.n5.nabble.com/file/**n5597650/pams-core-xsd-server-**
>>>>> 1.3.0_ba_nemo-SNAPSHOT.jar<http://cxf.547215.n5.nabble.com/file/n5597650/pams-core-xsd-server-1.3.0_ba_nemo-SNAPSHOT.jar>
>>>>>>
>>>>> pams-core-xsd-server-1.3.0_ba_****nemo-SNAPSHOT.jar
>>>>>
>>>>>
>>>>> Regards
>>>>> Kiren
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> View this message in context: http://cxf.547215.n5.nabble.**
>>>>> com/CXF-Test-client-for-JAXB-****load-testing-****
>>>>> tp5597650p5597650.html<http://**cxf.547215.n5.nabble.com/CXF-**
>>>>> Test-client-for-JAXB-load-**testing-tp5597650p5597650.html<http://cxf.547215.n5.nabble.com/CXF-Test-client-for-JAXB-load-testing-tp5597650p5597650.html>
>>>>> **>
>>>>>
>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>> --
>>>> Sergey Beryozkin
>>>>
>>>> Talend Community Coders
>>>> http://coders.talend.com/
>>>>
>>>> Blog: http://sberyozkin.blogspot.com
>>>>
>>>>
>>>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: CXF Test client for JAXB load testing

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Kiren
On 10/04/12 17:19, Kiren Pillay wrote:
> Hi Sergey!
>
> Sorry for the delay in getting back to you, we are having bank holidays on
> our side.:)
>
> The numbers are impressive, it looks like having a more powerful CPU  plays
> a big role, however I never expected it to be more than twice as fast?

Yea, I know the CXF performance figures can be pretty hard to believe 
sometimes to, they are so good :-)

> (time to motivate for a new laptop :)
>
Indeed :-).

Cheers, Sergey
> Thanks for the help!
>
> Regards
> Kiren
>
>
> On Thu, Apr 5, 2012 at 3:23 PM, Sergey Beryozkin<sb...@gmail.com>wrote:
>
>> Actually was testing with CXF 2.5.2
>>
>> Sergey
>>
>> On 05/04/12 16:04, Sergey Beryozkin wrote:
>>
>>> Hi Kiren
>>>
>>> sorry for a delay, here is the output from the test program on my laptop:
>>>
>>> pool-1-thread-1 awaiting
>>> pool-1-thread-2 awaiting
>>> pool-1-thread-3 awaiting
>>> pool-1-thread-4 awaiting
>>> pool-1-thread-5 awaiting
>>> pool-1-thread-6 awaiting
>>> pool-1-thread-7 awaiting
>>> pool-1-thread-8 awaiting
>>> pool-1-thread-9 awaiting
>>> pool-1-thread-10 awaiting
>>> pool-1-thread-10 started
>>> pool-1-thread-1 started
>>> pool-1-thread-2 started
>>> pool-1-thread-5 started
>>> pool-1-thread-4 started
>>> pool-1-thread-9 started
>>> pool-1-thread-3 started
>>> pool-1-thread-8 started
>>> pool-1-thread-7 started
>>> pool-1-thread-6 started
>>> pool-1-thread-5done
>>> pool-1-thread-8done
>>> pool-1-thread-4done
>>> pool-1-thread-10done
>>> pool-1-thread-3done
>>> pool-1-thread-6done
>>> pool-1-thread-1done
>>> pool-1-thread-2done
>>> pool-1-thread-7done
>>> pool-1-thread-9done
>>> Average exec time ... 36
>>> No Users:10
>>> NO_REQUESTS_PER_USER100
>>>
>>> Was 44 originally, then between 39-36
>>>
>>> Not too bad I guess given that we have 10 threads executing 100 requests
>>> simultaneously with JAXB marshalling/unmarshalling involved :-)
>>>
>>> I tried 2.6.0-SNAPSHOT. I'm getting convinced CXF is performing pretty
>>> well indeed :-), there could be a lot of other factors though affecting
>>> the actual performance data
>>>
>>> Cheers, Sergey
>>>
>>> On 28/03/12 18:59, Kiren Pillay wrote:
>>>
>>>> Hi Sergey!
>>>>
>>>> I've taken your multi-threaded project and modified it so that each
>>>> thread
>>>> sends a specific number of requests. What I am seeing is that the average
>>>> time is 100ms. Can you please confirm if this is correct? All my cores go
>>>> to 100% when I run this.
>>>>
>>>> Note that the Response object is our own xml Response object, and not the
>>>> CXF one.
>>>>
>>>> Regards
>>>> Kiren
>>>>
>>>> package za.co.kiren.load;
>>>>
>>>> import java.util.concurrent.**ArrayBlockingQueue;
>>>> import java.util.concurrent.**CountDownLatch;
>>>> import java.util.concurrent.**ThreadPoolExecutor;
>>>> import java.util.concurrent.TimeUnit;
>>>> import java.util.concurrent.atomic.**AtomicLong;
>>>>
>>>> import javax.ws.rs.core.MediaType;
>>>>
>>>> import org.apache.cxf.jaxrs.client.**WebClient;
>>>>
>>>> import za.co.xxx.pams.messaging.**response.Response;
>>>>
>>>> public class MultiUserLoadTest {
>>>>
>>>> private static final int NO_USERS = 10;
>>>> private static final int NO_REQUESTS_PER_USER = 1000/NO_USERS;
>>>>
>>>> public static void main(String[] args) throws InterruptedException {
>>>>
>>>> AtomicLong totalTime=new AtomicLong();
>>>>
>>>> ThreadPoolExecutor executor = new ThreadPoolExecutor(NO_USERS,
>>>> NO_USERS, 0,
>>>> TimeUnit.SECONDS, new
>>>> ArrayBlockingQueue<Runnable>(**NO_USERS));
>>>> CountDownLatch startSignal = new CountDownLatch(1);
>>>> CountDownLatch doneSignal = new CountDownLatch(NO_USERS);
>>>>
>>>> for (int j = 0; j<  NO_USERS; j++) {
>>>> executor.execute(new MultiUserLoadTest().new
>>>> Worker(totalTime,
>>>> startSignal, doneSignal));
>>>> }
>>>> startSignal.countDown();
>>>> doneSignal.await(120, TimeUnit.SECONDS);
>>>> executor.shutdownNow();
>>>> if (doneSignal.getCount() != 0) {
>>>> throw new RuntimeException("Not all threads done, must have
>>>> timed out?");
>>>> }
>>>>
>>>> System.out.println("Average exec time ... " +
>>>> totalTime.intValue()
>>>> / (NO_USERS*NO_REQUESTS_PER_**USER));
>>>>
>>>> System.out.println("No Users:"+NO_USERS);
>>>> System.out.println("NO_**REQUESTS_PER_USER"+NO_**REQUESTS_PER_USER);
>>>>
>>>> }
>>>>
>>>> class Worker implements Runnable {
>>>> private final AtomicLong total;
>>>> private CountDownLatch startSignal;
>>>> private CountDownLatch doneSignal;
>>>> private int count=0;
>>>> private String threadName;
>>>>
>>>> public Worker(AtomicLong total, CountDownLatch startSignal,
>>>> CountDownLatch doneSignal) {
>>>> this.total = total;
>>>> this.startSignal = startSignal;
>>>> this.doneSignal = doneSignal;
>>>> }
>>>>
>>>> @Override
>>>> public void run() {
>>>> threadName=Thread.**currentThread().getName();
>>>> try {
>>>> System.out.println(Thread.**currentThread().getName()+"
>>>> awaiting");
>>>> startSignal.await();
>>>> System.out.println(Thread.**currentThread().getName()+"
>>>> started");
>>>>
>>>> WebClient wc = WebClient.create(
>>>> "http://localhost:8080/**RestTest/rest/test/xml<http://localhost:8080/RestTest/rest/test/xml>
>>>> ",
>>>> "user", "passwordt", null);
>>>> wc.accept(MediaType.TEXT_XML);
>>>>
>>>> for (int i = 0; i<  NO_REQUESTS_PER_USER; i++) {
>>>> count++;
>>>> /* wc.replaceQueryParam("**batchNumber",
>>>> ((int) (1000 + Math.random() * 100)));*/
>>>> long l1 = System.currentTimeMillis();
>>>> Response response = wc.get(Response.class);
>>>>
>>>> long l2 = System.currentTimeMillis();
>>>>
>>>> total.getAndAdd(l2 - l1);
>>>> }
>>>>
>>>> doneSignal.countDown();
>>>> System.out.println(Thread.**currentThread().getName()+"
>>>> done");
>>>>
>>>> } catch (Exception ex) {
>>>> System.err.println(threadName+**" "+ex.getMessage());
>>>> ;
>>>> throw new RuntimeException();
>>>> }
>>>> }
>>>>
>>>> }
>>>>
>>>>
>>>>
>>>> }
>>>>
>>>>
>>>> On Wed, Mar 28, 2012 at 12:20 PM, Sergey
>>>> Beryozkin<sberyozkin@gmail.com**>wrote:
>>>>
>>>>   Hi Kiren
>>>>>
>>>>> On 28/03/12 10:33, Kiren Pillay wrote:
>>>>>
>>>>>   Hi Sergey!
>>>>>>
>>>>>> With your code I'm getting 13 ms average on my Tomcat server and
>>>>>> 34ms on
>>>>>> Jetty maven plugin (I was actually expecting the opposite).
>>>>>>
>>>>>> Against the String response url I'm getting 4ms on Tomcat and 5ms on
>>>>>> Jetty.
>>>>>>
>>>>>> I think now we're getting down to the level of differences in the
>>>>>> quality
>>>>>> of our hardware, I've got an intel I5 (M 430 @ 2.27GHz) laptop with
>>>>>> plenty of RAM, you probably have a better machine. I'm running Java 7
>>>>>> update 3 on a linux 64bit Ubuntu 11.10 machine.
>>>>>>
>>>>>> I have I7 with few processors and plenty of memory, so that can explain
>>>>>>
>>>>> some difference. Java6&  Ubuntu 11.04. Please try CXF 2.5.3-SNAPSHOT,
>>>>> that
>>>>> might help with saving few milliseconds too plus in case of JAXB -
>>>>> save on
>>>>> the pretty-printing 'expenses' which you already verified.
>>>>>
>>>>> What I think is that the server runtime is performing pretty well, the
>>>>> client runtimes have different qualities though and that can affect the
>>>>> performance measurements...
>>>>>
>>>>> Wonder how would JIXB perform :-)
>>>>>
>>>>> Cheers, Sergey
>>>>>
>>>>> Regards
>>>>>
>>>>>> Kiren
>>>>>>
>>>>>> On Tue, Mar 27, 2012 at 11:04 PM, Sergey
>>>>>> Beryozkin<sberyozkin@gmail.com****
>>>>>>
>>>>>>> wrote:
>>>>>>>
>>>>>>
>>>>>> Hi Kiren
>>>>>>
>>>>>>>
>>>>>>> On 27/03/12 13:09, Kiren Pillay wrote:
>>>>>>>
>>>>>>> Hi Sergey,
>>>>>>>
>>>>>>>>
>>>>>>>> Attached is a war file against which I am testing my client.
>>>>>>>>
>>>>>>>> great, thanks
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> The test URLS
>>>>>>>
>>>>>>>   are given below together with the Jamon stats for a 1000 hits.
>>>>>>>>
>>>>>>>>
>>>>>>>> 1. Large response (27k)
>>>>>>>>
>>>>>>>> url="http://localhost:8080/******RestTest/rest/test/long/27000<http://localhost:8080/****RestTest/rest/test/long/27000>
>>>>>>>> **<http://localhost:8080/****RestTest/rest/test/long/27000<http://localhost:8080/**RestTest/rest/test/long/27000>
>>>>>>>>>
>>>>>>>>
>>>>>>>> <**http://localhost:8080/****RestTest/rest/test/long/27000<http://localhost:8080/**RestTest/rest/test/long/27000>
>>>>>>>> <**http://localhost:8080/**RestTest/rest/test/long/27000<http://localhost:8080/RestTest/rest/test/long/27000>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>   "**;
>>>>>>>>
>>>>>>>> JAMon Label=myCodeTimer, Units=ms.: (Hits=1000.0, Avg=7.77,
>>>>>>>> Total=7770.0,
>>>>>>>> Min=4.0
>>>>>>>> tps:128.5512276642242
>>>>>>>>
>>>>>>>> 2. Small response
>>>>>>>>
>>>>>>>> url="http://localhost:8080/******RestTest/rest/test/short<http://localhost:8080/****RestTest/rest/test/short>
>>>>>>>> <http**://localhost:8080/**RestTest/**rest/test/short<http://localhost:8080/**RestTest/rest/test/short>
>>>>>>>>>
>>>>>>>>
>>>>>>>> <http:**//localhost:8080/**RestTest/**rest/test/short<htt**
>>>>>>>> p://localhost:8080/RestTest/**rest/test/short<http://localhost:8080/RestTest/rest/test/short>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>> ";
>>>>>>>> JAMon Label=myCodeTimer, Units=ms.: (Hits=1000.0, Avg=5.454,
>>>>>>>> Total=5454.0,
>>>>>>>> Min=3.0, Max=37.0
>>>>>>>> tps:183.0831197363603
>>>>>>>>
>>>>>>>> 3. Dummy Response using the JAXB schema
>>>>>>>>
>>>>>>>> url="http://localhost:8080/******RestTest/rest/test/xml<http://localhost:8080/****RestTest/rest/test/xml>
>>>>>>>> <http:/**/localhost:8080/**RestTest/**rest/test/xml<http://localhost:8080/**RestTest/rest/test/xml>
>>>>>>>>>
>>>>>>>>
>>>>>>>> <http://**localhost:8080/**RestTest/rest/**test/xml<http:**
>>>>>>>> //localhost:8080/RestTest/**rest/test/xml<http://localhost:8080/RestTest/rest/test/xml>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>> ";
>>>>>>>> JAMon Label=myCodeTimer, Units=ms.: (Hits=1000.0, Avg=15.381,
>>>>>>>> Total=15381.0,
>>>>>>>> Min=9.0, Max=542.0,
>>>>>>>> tps:64.96037417175522
>>>>>>>>
>>>>>>>>
>>>>>>>> With the following code:
>>>>>>>>
>>>>>>>
>>>>>>> WebClient wc = WebClient.create("http://****
>>>>>>> localhost:8080/RestTest/rest/******
>>>>>>> test/xml<http://localhost:****8080/RestTest/rest/test/xml<ht**
>>>>>>> tp://localhost:8080/RestTest/**rest/test/xml<http://localhost:8080/RestTest/rest/test/xml>
>>>>>>>>
>>>>>>>
>>>>>>>   ")**;
>>>>>>>>
>>>>>>>
>>>>>>> wc.accept("text/xml");
>>>>>>> // warm up a bit
>>>>>>> for (int i = 0; i<  50; i++) {
>>>>>>> wc.get();
>>>>>>> }
>>>>>>>
>>>>>>> long total = 0;
>>>>>>> for (int i = 0; i<  1000; i++) {
>>>>>>> long l1 = System.currentTimeMillis();
>>>>>>> wc.get(Document.class);
>>>>>>> long l2 = System.currentTimeMillis();
>>>>>>>
>>>>>>> total += l2-l1;
>>>>>>> }
>>>>>>> System.out.println("Average: " + total/1000);
>>>>>>>
>>>>>>> I'm getting 10 millisecs average. Note I'm adding a Document
>>>>>>> reading just
>>>>>>> to eliminate any optimizations with webClient.get() where no actual
>>>>>>> read
>>>>>>> is
>>>>>>> done.
>>>>>>>
>>>>>>> Running the same code against
>>>>>>> http://localhost:8080/******RestTest/rest/test/long/27000<http://localhost:8080/****RestTest/rest/test/long/27000>
>>>>>>> <**http://localhost:8080/****RestTest/rest/test/long/27000<http://localhost:8080/**RestTest/rest/test/long/27000>
>>>>>>>>
>>>>>>>
>>>>>>> <**http://localhost:8080/****RestTest/rest/test/long/27000<http://localhost:8080/**RestTest/rest/test/long/27000>
>>>>>>> <**http://localhost:8080/**RestTest/rest/test/long/27000<http://localhost:8080/RestTest/rest/test/long/27000>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> (changing address, accept to text/plain, and
>>>>>>> wc.get(Document.class); to
>>>>>>> wc.get(String.class);)
>>>>>>>
>>>>>>> gives me 2 milliseconds average.
>>>>>>>
>>>>>>>
>>>>>>> Can you try the same code please ?
>>>>>>>
>>>>>>> Cheers, Sergey
>>>>>>>
>>>>>>>
>>>>>>> I've include our custom JAXB-enabled schema jar, the rest you can
>>>>>>> build
>>>>>>>
>>>>>>>   from
>>>>>>>> maven pom.xml.
>>>>>>>>
>>>>>>>> http://cxf.547215.n5.nabble.******com/file/n5597650/****
>>>>>>>> RestWarProject.tar.gz<http://****cxf.547215.n5.nabble.com/**file/**<http://cxf.547215.n5.nabble.com/file/**>
>>>>>>>> n5597650/RestWarProject.tar.**gz<http://cxf.547215.n5.**
>>>>>>>> nabble.com/file/n5597650/**RestWarProject.tar.gz<http://cxf.547215.n5.nabble.com/file/n5597650/RestWarProject.tar.gz>
>>>>>>>>>
>>>>>>>>
>>>>>>>> **>
>>>>>>>>
>>>>>>>> RestWarProject.tar.gz
>>>>>>>>
>>>>>>>> Custom JAXB schema file:
>>>>>>>>
>>>>>>>> http://cxf.547215.n5.nabble.******com/file/n5597650/pams-core-****
>>>>>>>> xsd-server-1.3.0_ba_nemo-******SNAPSHOT.jar<http://cxf.**
>>>>>>>> 547215.n5.nabble.com/file/****n5597650/pams-core-xsd-server-****<http://547215.n5.nabble.com/file/**n5597650/pams-core-xsd-server-**>
>>>>>>>> 1.3.0_ba_nemo-SNAPSHOT.jar<htt**p://cxf.547215.n5.nabble.com/**
>>>>>>>> file/n5597650/pams-core-xsd-**server-1.3.0_ba_nemo-SNAPSHOT.**jar<http://cxf.547215.n5.nabble.com/file/n5597650/pams-core-xsd-server-1.3.0_ba_nemo-SNAPSHOT.jar>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>   pams-core-xsd-server-1.3.0_ba_******nemo-SNAPSHOT.jar
>>>>>>>>
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> Kiren
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> View this message in context: http://cxf.547215.n5.nabble.**
>>>>>>>> com/CXF-Test-client-for-JAXB-******load-testing-****
>>>>>>>> tp5597650p5597650.html<http://****cxf.547215.n5.nabble.com/**CXF-**<http://cxf.547215.n5.nabble.com/CXF-**>
>>>>>>>> Test-client-for-JAXB-load-****testing-tp5597650p5597650.**html<
>>>>>>>> http://cxf.547215.n5.**nabble.com/CXF-Test-client-**
>>>>>>>> for-JAXB-load-testing-**tp5597650p5597650.html<http://cxf.547215.n5.nabble.com/CXF-Test-client-for-JAXB-load-testing-tp5597650p5597650.html>
>>>>>>>>>
>>>>>>>>
>>>>>>>> **>
>>>>>>>>
>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> --
>>>>>>> Sergey Beryozkin
>>>>>>>
>>>>>>> Talend Community Coders
>>>>>>> http://coders.talend.com/
>>>>>>>
>>>>>>> Blog: http://sberyozkin.blogspot.com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>>
>>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>> Blog: http://sberyozkin.blogspot.com
>>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: CXF Test client for JAXB load testing

Posted by Kiren Pillay <ki...@gmail.com>.
Hi Sergey!

Sorry for the delay in getting back to you, we are having bank holidays on
our side.:)

The numbers are impressive, it looks like having a more powerful CPU  plays
a big role, however I never expected it to be more than twice as fast?
(time to motivate for a new laptop :)

Thanks for the help!

Regards
Kiren


On Thu, Apr 5, 2012 at 3:23 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Actually was testing with CXF 2.5.2
>
> Sergey
>
> On 05/04/12 16:04, Sergey Beryozkin wrote:
>
>> Hi Kiren
>>
>> sorry for a delay, here is the output from the test program on my laptop:
>>
>> pool-1-thread-1 awaiting
>> pool-1-thread-2 awaiting
>> pool-1-thread-3 awaiting
>> pool-1-thread-4 awaiting
>> pool-1-thread-5 awaiting
>> pool-1-thread-6 awaiting
>> pool-1-thread-7 awaiting
>> pool-1-thread-8 awaiting
>> pool-1-thread-9 awaiting
>> pool-1-thread-10 awaiting
>> pool-1-thread-10 started
>> pool-1-thread-1 started
>> pool-1-thread-2 started
>> pool-1-thread-5 started
>> pool-1-thread-4 started
>> pool-1-thread-9 started
>> pool-1-thread-3 started
>> pool-1-thread-8 started
>> pool-1-thread-7 started
>> pool-1-thread-6 started
>> pool-1-thread-5done
>> pool-1-thread-8done
>> pool-1-thread-4done
>> pool-1-thread-10done
>> pool-1-thread-3done
>> pool-1-thread-6done
>> pool-1-thread-1done
>> pool-1-thread-2done
>> pool-1-thread-7done
>> pool-1-thread-9done
>> Average exec time ... 36
>> No Users:10
>> NO_REQUESTS_PER_USER100
>>
>> Was 44 originally, then between 39-36
>>
>> Not too bad I guess given that we have 10 threads executing 100 requests
>> simultaneously with JAXB marshalling/unmarshalling involved :-)
>>
>> I tried 2.6.0-SNAPSHOT. I'm getting convinced CXF is performing pretty
>> well indeed :-), there could be a lot of other factors though affecting
>> the actual performance data
>>
>> Cheers, Sergey
>>
>> On 28/03/12 18:59, Kiren Pillay wrote:
>>
>>> Hi Sergey!
>>>
>>> I've taken your multi-threaded project and modified it so that each
>>> thread
>>> sends a specific number of requests. What I am seeing is that the average
>>> time is 100ms. Can you please confirm if this is correct? All my cores go
>>> to 100% when I run this.
>>>
>>> Note that the Response object is our own xml Response object, and not the
>>> CXF one.
>>>
>>> Regards
>>> Kiren
>>>
>>> package za.co.kiren.load;
>>>
>>> import java.util.concurrent.**ArrayBlockingQueue;
>>> import java.util.concurrent.**CountDownLatch;
>>> import java.util.concurrent.**ThreadPoolExecutor;
>>> import java.util.concurrent.TimeUnit;
>>> import java.util.concurrent.atomic.**AtomicLong;
>>>
>>> import javax.ws.rs.core.MediaType;
>>>
>>> import org.apache.cxf.jaxrs.client.**WebClient;
>>>
>>> import za.co.xxx.pams.messaging.**response.Response;
>>>
>>> public class MultiUserLoadTest {
>>>
>>> private static final int NO_USERS = 10;
>>> private static final int NO_REQUESTS_PER_USER = 1000/NO_USERS;
>>>
>>> public static void main(String[] args) throws InterruptedException {
>>>
>>> AtomicLong totalTime=new AtomicLong();
>>>
>>> ThreadPoolExecutor executor = new ThreadPoolExecutor(NO_USERS,
>>> NO_USERS, 0,
>>> TimeUnit.SECONDS, new
>>> ArrayBlockingQueue<Runnable>(**NO_USERS));
>>> CountDownLatch startSignal = new CountDownLatch(1);
>>> CountDownLatch doneSignal = new CountDownLatch(NO_USERS);
>>>
>>> for (int j = 0; j< NO_USERS; j++) {
>>> executor.execute(new MultiUserLoadTest().new
>>> Worker(totalTime,
>>> startSignal, doneSignal));
>>> }
>>> startSignal.countDown();
>>> doneSignal.await(120, TimeUnit.SECONDS);
>>> executor.shutdownNow();
>>> if (doneSignal.getCount() != 0) {
>>> throw new RuntimeException("Not all threads done, must have
>>> timed out?");
>>> }
>>>
>>> System.out.println("Average exec time ... " +
>>> totalTime.intValue()
>>> / (NO_USERS*NO_REQUESTS_PER_**USER));
>>>
>>> System.out.println("No Users:"+NO_USERS);
>>> System.out.println("NO_**REQUESTS_PER_USER"+NO_**REQUESTS_PER_USER);
>>>
>>> }
>>>
>>> class Worker implements Runnable {
>>> private final AtomicLong total;
>>> private CountDownLatch startSignal;
>>> private CountDownLatch doneSignal;
>>> private int count=0;
>>> private String threadName;
>>>
>>> public Worker(AtomicLong total, CountDownLatch startSignal,
>>> CountDownLatch doneSignal) {
>>> this.total = total;
>>> this.startSignal = startSignal;
>>> this.doneSignal = doneSignal;
>>> }
>>>
>>> @Override
>>> public void run() {
>>> threadName=Thread.**currentThread().getName();
>>> try {
>>> System.out.println(Thread.**currentThread().getName()+"
>>> awaiting");
>>> startSignal.await();
>>> System.out.println(Thread.**currentThread().getName()+"
>>> started");
>>>
>>> WebClient wc = WebClient.create(
>>> "http://localhost:8080/**RestTest/rest/test/xml<http://localhost:8080/RestTest/rest/test/xml>
>>> ",
>>> "user", "passwordt", null);
>>> wc.accept(MediaType.TEXT_XML);
>>>
>>> for (int i = 0; i< NO_REQUESTS_PER_USER; i++) {
>>> count++;
>>> /* wc.replaceQueryParam("**batchNumber",
>>> ((int) (1000 + Math.random() * 100)));*/
>>> long l1 = System.currentTimeMillis();
>>> Response response = wc.get(Response.class);
>>>
>>> long l2 = System.currentTimeMillis();
>>>
>>> total.getAndAdd(l2 - l1);
>>> }
>>>
>>> doneSignal.countDown();
>>> System.out.println(Thread.**currentThread().getName()+"
>>> done");
>>>
>>> } catch (Exception ex) {
>>> System.err.println(threadName+**" "+ex.getMessage());
>>> ;
>>> throw new RuntimeException();
>>> }
>>> }
>>>
>>> }
>>>
>>>
>>>
>>> }
>>>
>>>
>>> On Wed, Mar 28, 2012 at 12:20 PM, Sergey
>>> Beryozkin<sberyozkin@gmail.com**>wrote:
>>>
>>>  Hi Kiren
>>>>
>>>> On 28/03/12 10:33, Kiren Pillay wrote:
>>>>
>>>>  Hi Sergey!
>>>>>
>>>>> With your code I'm getting 13 ms average on my Tomcat server and
>>>>> 34ms on
>>>>> Jetty maven plugin (I was actually expecting the opposite).
>>>>>
>>>>> Against the String response url I'm getting 4ms on Tomcat and 5ms on
>>>>> Jetty.
>>>>>
>>>>> I think now we're getting down to the level of differences in the
>>>>> quality
>>>>> of our hardware, I've got an intel I5 (M 430 @ 2.27GHz) laptop with
>>>>> plenty of RAM, you probably have a better machine. I'm running Java 7
>>>>> update 3 on a linux 64bit Ubuntu 11.10 machine.
>>>>>
>>>>> I have I7 with few processors and plenty of memory, so that can explain
>>>>>
>>>> some difference. Java6& Ubuntu 11.04. Please try CXF 2.5.3-SNAPSHOT,
>>>> that
>>>> might help with saving few milliseconds too plus in case of JAXB -
>>>> save on
>>>> the pretty-printing 'expenses' which you already verified.
>>>>
>>>> What I think is that the server runtime is performing pretty well, the
>>>> client runtimes have different qualities though and that can affect the
>>>> performance measurements...
>>>>
>>>> Wonder how would JIXB perform :-)
>>>>
>>>> Cheers, Sergey
>>>>
>>>> Regards
>>>>
>>>>> Kiren
>>>>>
>>>>> On Tue, Mar 27, 2012 at 11:04 PM, Sergey
>>>>> Beryozkin<sberyozkin@gmail.com****
>>>>>
>>>>>> wrote:
>>>>>>
>>>>>
>>>>> Hi Kiren
>>>>>
>>>>>>
>>>>>> On 27/03/12 13:09, Kiren Pillay wrote:
>>>>>>
>>>>>> Hi Sergey,
>>>>>>
>>>>>>>
>>>>>>> Attached is a war file against which I am testing my client.
>>>>>>>
>>>>>>> great, thanks
>>>>>>>
>>>>>>
>>>>>>
>>>>>> The test URLS
>>>>>>
>>>>>>  are given below together with the Jamon stats for a 1000 hits.
>>>>>>>
>>>>>>>
>>>>>>> 1. Large response (27k)
>>>>>>>
>>>>>>> url="http://localhost:8080/******RestTest/rest/test/long/27000<http://localhost:8080/****RestTest/rest/test/long/27000>
>>>>>>> **<http://localhost:8080/****RestTest/rest/test/long/27000<http://localhost:8080/**RestTest/rest/test/long/27000>
>>>>>>> >
>>>>>>>
>>>>>>> <**http://localhost:8080/****RestTest/rest/test/long/27000<http://localhost:8080/**RestTest/rest/test/long/27000>
>>>>>>> <**http://localhost:8080/**RestTest/rest/test/long/27000<http://localhost:8080/RestTest/rest/test/long/27000>
>>>>>>> >
>>>>>>>
>>>>>>>
>>>>>>>>  "**;
>>>>>>>
>>>>>>> JAMon Label=myCodeTimer, Units=ms.: (Hits=1000.0, Avg=7.77,
>>>>>>> Total=7770.0,
>>>>>>> Min=4.0
>>>>>>> tps:128.5512276642242
>>>>>>>
>>>>>>> 2. Small response
>>>>>>>
>>>>>>> url="http://localhost:8080/******RestTest/rest/test/short<http://localhost:8080/****RestTest/rest/test/short>
>>>>>>> <http**://localhost:8080/**RestTest/**rest/test/short<http://localhost:8080/**RestTest/rest/test/short>
>>>>>>> >
>>>>>>>
>>>>>>> <http:**//localhost:8080/**RestTest/**rest/test/short<htt**
>>>>>>> p://localhost:8080/RestTest/**rest/test/short<http://localhost:8080/RestTest/rest/test/short>
>>>>>>> >
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>> ";
>>>>>>> JAMon Label=myCodeTimer, Units=ms.: (Hits=1000.0, Avg=5.454,
>>>>>>> Total=5454.0,
>>>>>>> Min=3.0, Max=37.0
>>>>>>> tps:183.0831197363603
>>>>>>>
>>>>>>> 3. Dummy Response using the JAXB schema
>>>>>>>
>>>>>>> url="http://localhost:8080/******RestTest/rest/test/xml<http://localhost:8080/****RestTest/rest/test/xml>
>>>>>>> <http:/**/localhost:8080/**RestTest/**rest/test/xml<http://localhost:8080/**RestTest/rest/test/xml>
>>>>>>> >
>>>>>>>
>>>>>>> <http://**localhost:8080/**RestTest/rest/**test/xml<http:**
>>>>>>> //localhost:8080/RestTest/**rest/test/xml<http://localhost:8080/RestTest/rest/test/xml>
>>>>>>> >
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>> ";
>>>>>>> JAMon Label=myCodeTimer, Units=ms.: (Hits=1000.0, Avg=15.381,
>>>>>>> Total=15381.0,
>>>>>>> Min=9.0, Max=542.0,
>>>>>>> tps:64.96037417175522
>>>>>>>
>>>>>>>
>>>>>>> With the following code:
>>>>>>>
>>>>>>
>>>>>> WebClient wc = WebClient.create("http://****
>>>>>> localhost:8080/RestTest/rest/******
>>>>>> test/xml<http://localhost:****8080/RestTest/rest/test/xml<ht**
>>>>>> tp://localhost:8080/RestTest/**rest/test/xml<http://localhost:8080/RestTest/rest/test/xml>
>>>>>> >
>>>>>>
>>>>>>  ")**;
>>>>>>>
>>>>>>
>>>>>> wc.accept("text/xml");
>>>>>> // warm up a bit
>>>>>> for (int i = 0; i< 50; i++) {
>>>>>> wc.get();
>>>>>> }
>>>>>>
>>>>>> long total = 0;
>>>>>> for (int i = 0; i< 1000; i++) {
>>>>>> long l1 = System.currentTimeMillis();
>>>>>> wc.get(Document.class);
>>>>>> long l2 = System.currentTimeMillis();
>>>>>>
>>>>>> total += l2-l1;
>>>>>> }
>>>>>> System.out.println("Average: " + total/1000);
>>>>>>
>>>>>> I'm getting 10 millisecs average. Note I'm adding a Document
>>>>>> reading just
>>>>>> to eliminate any optimizations with webClient.get() where no actual
>>>>>> read
>>>>>> is
>>>>>> done.
>>>>>>
>>>>>> Running the same code against
>>>>>> http://localhost:8080/******RestTest/rest/test/long/27000<http://localhost:8080/****RestTest/rest/test/long/27000>
>>>>>> <**http://localhost:8080/****RestTest/rest/test/long/27000<http://localhost:8080/**RestTest/rest/test/long/27000>
>>>>>> >
>>>>>>
>>>>>> <**http://localhost:8080/****RestTest/rest/test/long/27000<http://localhost:8080/**RestTest/rest/test/long/27000>
>>>>>> <**http://localhost:8080/**RestTest/rest/test/long/27000<http://localhost:8080/RestTest/rest/test/long/27000>
>>>>>> >
>>>>>>
>>>>>>
>>>>>>>
>>>>>>
>>>>>> (changing address, accept to text/plain, and
>>>>>> wc.get(Document.class); to
>>>>>> wc.get(String.class);)
>>>>>>
>>>>>> gives me 2 milliseconds average.
>>>>>>
>>>>>>
>>>>>> Can you try the same code please ?
>>>>>>
>>>>>> Cheers, Sergey
>>>>>>
>>>>>>
>>>>>> I've include our custom JAXB-enabled schema jar, the rest you can
>>>>>> build
>>>>>>
>>>>>>  from
>>>>>>> maven pom.xml.
>>>>>>>
>>>>>>> http://cxf.547215.n5.nabble.******com/file/n5597650/****
>>>>>>> RestWarProject.tar.gz<http://****cxf.547215.n5.nabble.com/**file/**<http://cxf.547215.n5.nabble.com/file/**>
>>>>>>> n5597650/RestWarProject.tar.**gz<http://cxf.547215.n5.**
>>>>>>> nabble.com/file/n5597650/**RestWarProject.tar.gz<http://cxf.547215.n5.nabble.com/file/n5597650/RestWarProject.tar.gz>
>>>>>>> >
>>>>>>>
>>>>>>> **>
>>>>>>>
>>>>>>> RestWarProject.tar.gz
>>>>>>>
>>>>>>> Custom JAXB schema file:
>>>>>>>
>>>>>>> http://cxf.547215.n5.nabble.******com/file/n5597650/pams-core-****
>>>>>>> xsd-server-1.3.0_ba_nemo-******SNAPSHOT.jar<http://cxf.**
>>>>>>> 547215.n5.nabble.com/file/****n5597650/pams-core-xsd-server-****<http://547215.n5.nabble.com/file/**n5597650/pams-core-xsd-server-**>
>>>>>>> 1.3.0_ba_nemo-SNAPSHOT.jar<htt**p://cxf.547215.n5.nabble.com/**
>>>>>>> file/n5597650/pams-core-xsd-**server-1.3.0_ba_nemo-SNAPSHOT.**jar<http://cxf.547215.n5.nabble.com/file/n5597650/pams-core-xsd-server-1.3.0_ba_nemo-SNAPSHOT.jar>
>>>>>>> >
>>>>>>>
>>>>>>>
>>>>>>>>  pams-core-xsd-server-1.3.0_ba_******nemo-SNAPSHOT.jar
>>>>>>>
>>>>>>>
>>>>>>> Regards
>>>>>>> Kiren
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context: http://cxf.547215.n5.nabble.**
>>>>>>> com/CXF-Test-client-for-JAXB-******load-testing-****
>>>>>>> tp5597650p5597650.html<http://****cxf.547215.n5.nabble.com/**CXF-**<http://cxf.547215.n5.nabble.com/CXF-**>
>>>>>>> Test-client-for-JAXB-load-****testing-tp5597650p5597650.**html<
>>>>>>> http://cxf.547215.n5.**nabble.com/CXF-Test-client-**
>>>>>>> for-JAXB-load-testing-**tp5597650p5597650.html<http://cxf.547215.n5.nabble.com/CXF-Test-client-for-JAXB-load-testing-tp5597650p5597650.html>
>>>>>>> >
>>>>>>>
>>>>>>> **>
>>>>>>>
>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> --
>>>>>> Sergey Beryozkin
>>>>>>
>>>>>> Talend Community Coders
>>>>>> http://coders.talend.com/
>>>>>>
>>>>>> Blog: http://sberyozkin.blogspot.com
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>

Re: CXF Test client for JAXB load testing

Posted by Sergey Beryozkin <sb...@gmail.com>.
Actually was testing with CXF 2.5.2

Sergey
On 05/04/12 16:04, Sergey Beryozkin wrote:
> Hi Kiren
>
> sorry for a delay, here is the output from the test program on my laptop:
>
> pool-1-thread-1 awaiting
> pool-1-thread-2 awaiting
> pool-1-thread-3 awaiting
> pool-1-thread-4 awaiting
> pool-1-thread-5 awaiting
> pool-1-thread-6 awaiting
> pool-1-thread-7 awaiting
> pool-1-thread-8 awaiting
> pool-1-thread-9 awaiting
> pool-1-thread-10 awaiting
> pool-1-thread-10 started
> pool-1-thread-1 started
> pool-1-thread-2 started
> pool-1-thread-5 started
> pool-1-thread-4 started
> pool-1-thread-9 started
> pool-1-thread-3 started
> pool-1-thread-8 started
> pool-1-thread-7 started
> pool-1-thread-6 started
> pool-1-thread-5done
> pool-1-thread-8done
> pool-1-thread-4done
> pool-1-thread-10done
> pool-1-thread-3done
> pool-1-thread-6done
> pool-1-thread-1done
> pool-1-thread-2done
> pool-1-thread-7done
> pool-1-thread-9done
> Average exec time ... 36
> No Users:10
> NO_REQUESTS_PER_USER100
>
> Was 44 originally, then between 39-36
>
> Not too bad I guess given that we have 10 threads executing 100 requests
> simultaneously with JAXB marshalling/unmarshalling involved :-)
>
> I tried 2.6.0-SNAPSHOT. I'm getting convinced CXF is performing pretty
> well indeed :-), there could be a lot of other factors though affecting
> the actual performance data
>
> Cheers, Sergey
>
> On 28/03/12 18:59, Kiren Pillay wrote:
>> Hi Sergey!
>>
>> I've taken your multi-threaded project and modified it so that each
>> thread
>> sends a specific number of requests. What I am seeing is that the average
>> time is 100ms. Can you please confirm if this is correct? All my cores go
>> to 100% when I run this.
>>
>> Note that the Response object is our own xml Response object, and not the
>> CXF one.
>>
>> Regards
>> Kiren
>>
>> package za.co.kiren.load;
>>
>> import java.util.concurrent.ArrayBlockingQueue;
>> import java.util.concurrent.CountDownLatch;
>> import java.util.concurrent.ThreadPoolExecutor;
>> import java.util.concurrent.TimeUnit;
>> import java.util.concurrent.atomic.AtomicLong;
>>
>> import javax.ws.rs.core.MediaType;
>>
>> import org.apache.cxf.jaxrs.client.WebClient;
>>
>> import za.co.xxx.pams.messaging.response.Response;
>>
>> public class MultiUserLoadTest {
>>
>> private static final int NO_USERS = 10;
>> private static final int NO_REQUESTS_PER_USER = 1000/NO_USERS;
>>
>> public static void main(String[] args) throws InterruptedException {
>>
>> AtomicLong totalTime=new AtomicLong();
>>
>> ThreadPoolExecutor executor = new ThreadPoolExecutor(NO_USERS,
>> NO_USERS, 0,
>> TimeUnit.SECONDS, new
>> ArrayBlockingQueue<Runnable>(NO_USERS));
>> CountDownLatch startSignal = new CountDownLatch(1);
>> CountDownLatch doneSignal = new CountDownLatch(NO_USERS);
>>
>> for (int j = 0; j< NO_USERS; j++) {
>> executor.execute(new MultiUserLoadTest().new
>> Worker(totalTime,
>> startSignal, doneSignal));
>> }
>> startSignal.countDown();
>> doneSignal.await(120, TimeUnit.SECONDS);
>> executor.shutdownNow();
>> if (doneSignal.getCount() != 0) {
>> throw new RuntimeException("Not all threads done, must have
>> timed out?");
>> }
>>
>> System.out.println("Average exec time ... " +
>> totalTime.intValue()
>> / (NO_USERS*NO_REQUESTS_PER_USER));
>>
>> System.out.println("No Users:"+NO_USERS);
>> System.out.println("NO_REQUESTS_PER_USER"+NO_REQUESTS_PER_USER);
>>
>> }
>>
>> class Worker implements Runnable {
>> private final AtomicLong total;
>> private CountDownLatch startSignal;
>> private CountDownLatch doneSignal;
>> private int count=0;
>> private String threadName;
>>
>> public Worker(AtomicLong total, CountDownLatch startSignal,
>> CountDownLatch doneSignal) {
>> this.total = total;
>> this.startSignal = startSignal;
>> this.doneSignal = doneSignal;
>> }
>>
>> @Override
>> public void run() {
>> threadName=Thread.currentThread().getName();
>> try {
>> System.out.println(Thread.currentThread().getName()+"
>> awaiting");
>> startSignal.await();
>> System.out.println(Thread.currentThread().getName()+"
>> started");
>>
>> WebClient wc = WebClient.create(
>> "http://localhost:8080/RestTest/rest/test/xml",
>> "user", "passwordt", null);
>> wc.accept(MediaType.TEXT_XML);
>>
>> for (int i = 0; i< NO_REQUESTS_PER_USER; i++) {
>> count++;
>> /* wc.replaceQueryParam("batchNumber",
>> ((int) (1000 + Math.random() * 100)));*/
>> long l1 = System.currentTimeMillis();
>> Response response = wc.get(Response.class);
>>
>> long l2 = System.currentTimeMillis();
>>
>> total.getAndAdd(l2 - l1);
>> }
>>
>> doneSignal.countDown();
>> System.out.println(Thread.currentThread().getName()+"
>> done");
>>
>> } catch (Exception ex) {
>> System.err.println(threadName+" "+ex.getMessage());
>> ;
>> throw new RuntimeException();
>> }
>> }
>>
>> }
>>
>>
>>
>> }
>>
>>
>> On Wed, Mar 28, 2012 at 12:20 PM, Sergey
>> Beryozkin<sb...@gmail.com>wrote:
>>
>>> Hi Kiren
>>>
>>> On 28/03/12 10:33, Kiren Pillay wrote:
>>>
>>>> Hi Sergey!
>>>>
>>>> With your code I'm getting 13 ms average on my Tomcat server and
>>>> 34ms on
>>>> Jetty maven plugin (I was actually expecting the opposite).
>>>>
>>>> Against the String response url I'm getting 4ms on Tomcat and 5ms on
>>>> Jetty.
>>>>
>>>> I think now we're getting down to the level of differences in the
>>>> quality
>>>> of our hardware, I've got an intel I5 (M 430 @ 2.27GHz) laptop with
>>>> plenty of RAM, you probably have a better machine. I'm running Java 7
>>>> update 3 on a linux 64bit Ubuntu 11.10 machine.
>>>>
>>>> I have I7 with few processors and plenty of memory, so that can explain
>>> some difference. Java6& Ubuntu 11.04. Please try CXF 2.5.3-SNAPSHOT,
>>> that
>>> might help with saving few milliseconds too plus in case of JAXB -
>>> save on
>>> the pretty-printing 'expenses' which you already verified.
>>>
>>> What I think is that the server runtime is performing pretty well, the
>>> client runtimes have different qualities though and that can affect the
>>> performance measurements...
>>>
>>> Wonder how would JIXB perform :-)
>>>
>>> Cheers, Sergey
>>>
>>> Regards
>>>> Kiren
>>>>
>>>> On Tue, Mar 27, 2012 at 11:04 PM, Sergey
>>>> Beryozkin<sberyozkin@gmail.com**
>>>>> wrote:
>>>>
>>>> Hi Kiren
>>>>>
>>>>> On 27/03/12 13:09, Kiren Pillay wrote:
>>>>>
>>>>> Hi Sergey,
>>>>>>
>>>>>> Attached is a war file against which I am testing my client.
>>>>>>
>>>>>> great, thanks
>>>>>
>>>>>
>>>>> The test URLS
>>>>>
>>>>>> are given below together with the Jamon stats for a 1000 hits.
>>>>>>
>>>>>>
>>>>>> 1. Large response (27k)
>>>>>>
>>>>>> url="http://localhost:8080/****RestTest/rest/test/long/27000<http://localhost:8080/**RestTest/rest/test/long/27000>
>>>>>>
>>>>>> <**http://localhost:8080/**RestTest/rest/test/long/27000<http://localhost:8080/RestTest/rest/test/long/27000>
>>>>>>
>>>>>>>
>>>>>> "**;
>>>>>>
>>>>>> JAMon Label=myCodeTimer, Units=ms.: (Hits=1000.0, Avg=7.77,
>>>>>> Total=7770.0,
>>>>>> Min=4.0
>>>>>> tps:128.5512276642242
>>>>>>
>>>>>> 2. Small response
>>>>>>
>>>>>> url="http://localhost:8080/****RestTest/rest/test/short<http://localhost:8080/**RestTest/rest/test/short>
>>>>>>
>>>>>> <http:**//localhost:8080/RestTest/**rest/test/short<http://localhost:8080/RestTest/rest/test/short>
>>>>>>
>>>>>>>
>>>>>>
>>>>>> ";
>>>>>> JAMon Label=myCodeTimer, Units=ms.: (Hits=1000.0, Avg=5.454,
>>>>>> Total=5454.0,
>>>>>> Min=3.0, Max=37.0
>>>>>> tps:183.0831197363603
>>>>>>
>>>>>> 3. Dummy Response using the JAXB schema
>>>>>>
>>>>>> url="http://localhost:8080/****RestTest/rest/test/xml<http://localhost:8080/**RestTest/rest/test/xml>
>>>>>>
>>>>>> <http://**localhost:8080/RestTest/rest/**test/xml<http://localhost:8080/RestTest/rest/test/xml>
>>>>>>
>>>>>>>
>>>>>>
>>>>>> ";
>>>>>> JAMon Label=myCodeTimer, Units=ms.: (Hits=1000.0, Avg=15.381,
>>>>>> Total=15381.0,
>>>>>> Min=9.0, Max=542.0,
>>>>>> tps:64.96037417175522
>>>>>>
>>>>>>
>>>>>> With the following code:
>>>>>
>>>>> WebClient wc = WebClient.create("http://****
>>>>> localhost:8080/RestTest/rest/****
>>>>> test/xml<http://localhost:**8080/RestTest/rest/test/xml<http://localhost:8080/RestTest/rest/test/xml>
>>>>>
>>>>>> ")**;
>>>>>
>>>>> wc.accept("text/xml");
>>>>> // warm up a bit
>>>>> for (int i = 0; i< 50; i++) {
>>>>> wc.get();
>>>>> }
>>>>>
>>>>> long total = 0;
>>>>> for (int i = 0; i< 1000; i++) {
>>>>> long l1 = System.currentTimeMillis();
>>>>> wc.get(Document.class);
>>>>> long l2 = System.currentTimeMillis();
>>>>>
>>>>> total += l2-l1;
>>>>> }
>>>>> System.out.println("Average: " + total/1000);
>>>>>
>>>>> I'm getting 10 millisecs average. Note I'm adding a Document
>>>>> reading just
>>>>> to eliminate any optimizations with webClient.get() where no actual
>>>>> read
>>>>> is
>>>>> done.
>>>>>
>>>>> Running the same code against
>>>>> http://localhost:8080/****RestTest/rest/test/long/27000<http://localhost:8080/**RestTest/rest/test/long/27000>
>>>>>
>>>>> <**http://localhost:8080/**RestTest/rest/test/long/27000<http://localhost:8080/RestTest/rest/test/long/27000>
>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> (changing address, accept to text/plain, and
>>>>> wc.get(Document.class); to
>>>>> wc.get(String.class);)
>>>>>
>>>>> gives me 2 milliseconds average.
>>>>>
>>>>>
>>>>> Can you try the same code please ?
>>>>>
>>>>> Cheers, Sergey
>>>>>
>>>>>
>>>>> I've include our custom JAXB-enabled schema jar, the rest you can
>>>>> build
>>>>>
>>>>>> from
>>>>>> maven pom.xml.
>>>>>>
>>>>>> http://cxf.547215.n5.nabble.****com/file/n5597650/****
>>>>>> RestWarProject.tar.gz<http://**cxf.547215.n5.nabble.com/file/**
>>>>>> n5597650/RestWarProject.tar.gz<http://cxf.547215.n5.nabble.com/file/n5597650/RestWarProject.tar.gz>
>>>>>>
>>>>>> **>
>>>>>>
>>>>>> RestWarProject.tar.gz
>>>>>>
>>>>>> Custom JAXB schema file:
>>>>>>
>>>>>> http://cxf.547215.n5.nabble.****com/file/n5597650/pams-core-**
>>>>>> xsd-server-1.3.0_ba_nemo-****SNAPSHOT.jar<http://cxf.**
>>>>>> 547215.n5.nabble.com/file/**n5597650/pams-core-xsd-server-**
>>>>>> 1.3.0_ba_nemo-SNAPSHOT.jar<http://cxf.547215.n5.nabble.com/file/n5597650/pams-core-xsd-server-1.3.0_ba_nemo-SNAPSHOT.jar>
>>>>>>
>>>>>>>
>>>>>> pams-core-xsd-server-1.3.0_ba_****nemo-SNAPSHOT.jar
>>>>>>
>>>>>>
>>>>>> Regards
>>>>>> Kiren
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> View this message in context: http://cxf.547215.n5.nabble.**
>>>>>> com/CXF-Test-client-for-JAXB-****load-testing-****
>>>>>> tp5597650p5597650.html<http://**cxf.547215.n5.nabble.com/CXF-**
>>>>>> Test-client-for-JAXB-load-**testing-tp5597650p5597650.html<http://cxf.547215.n5.nabble.com/CXF-Test-client-for-JAXB-load-testing-tp5597650p5597650.html>
>>>>>>
>>>>>> **>
>>>>>>
>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Sergey Beryozkin
>>>>>
>>>>> Talend Community Coders
>>>>> http://coders.talend.com/
>>>>>
>>>>> Blog: http://sberyozkin.blogspot.com
>>>>>
>>>>>
>>>>
>>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com