Is there anyway to improve the performance, overall ? I experienced the same thing. My service scope is a "request" type. Can the app server conjure up a dummy service (so as to load apache code first time as you mentioned below ) and be ready for the actual service traffic ? My understanding is WebSphere doesn't load it dynamically...The classes are deployed and ready-to-serve when the server is boot up.
 
Regards,
 
Scott Nichol <[EMAIL PROTECTED]> wrote:
The long time for the first execution is probably time required for the JVM to load classes. Remember they are loaded dynamically as needed, not all at once when your app starts executing. There is a similar issue on the server. The first time any Apache SOAP service is invoked, tons of code has to be loaded, and it seems like it takes *forever*. The first time a different Apache SOAP service is invoked, the Apache SOAP code is loaded, but code for the service must be loaded, and there is a delay.

When I benchmark, I always write code to ignore the time of the first time through my loop so that I am not measuring the time required to load classes, etc.

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message -----
From: "Jia YU" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 24, 2003 12:40 AM
Subject: response time testing [urgent]


>
> I set up a web services with soap2.2.
>
> I want to time the response time on client sides. I wrote a loop to send
> request 10 times to the Web services. the first one is very long others
> are very short. if I start program again the result is same, first one
> is long but others are short.
>
> I attached the program pls help why? Do you have any idea how to do
> timing for web services?
>
> I also time the myrpc.invoke() the result is same first time is long
> others short.
>
> What can cause this problem? some wrong with my program? I knew the
> webservice use http service. it may have sock connection setup on the
> first time, but my question is I create new soap connection everytime in
> the loop,why the time is short after first query and why if I run new
> program again the first time become very long too. how can http server
> know it is different program rather than different soap call.
>
>
> Please help!!!
>
>
>
> ***This is my test program
> String sName=commandLine.getFlagArg("-serviceName");
>
> GMDQuery g=null;
> long time=0;
> for(int i=0;i<10;i++){
> try{
> //create a class which is for soap query (code is below)
> g=new
> GMDQuery(gmdHost,Integer.parseInt(port),soapDir,soapServiceName);
> Price p=null;
> long st=System.currentTimeMillis(); //start
> time
> p=g.getPrice(sName.trim());
> long ft=System.currentTimeMillis(); //finish
> time
> time=(ft-st)+time;
> System.out.println("Done: "+ (ft-st));
> System.out.println(p.toString());
> }catch(GMDQueryException e){
> System.err.println(e.getMessage());
> System.exit(2);
> }
>
> }//for
>
> ***My query class
>
> public class GMDQuery {
> Call myrpc;
> String servicePoint;
>
> public GMDQuery(String host, int port, String soapDir, String
> soapServiceName) throws GMDQueryException{
> Properties props = new Properties();
>
> servicePoint="http://"+host+":"+String.valueOf(port)+soapDir;
> System.out.println("Current GMD is on "+servicePoint+"\n");
>
> myrpc = new Call();
> myrpc.setTargetObjectURI(soapServiceName);
> }
>
> public Price getPrice(String sName) throws GMDQueryException{
> Element QueryPriceRoot=new Element("QUERY-PRICE");
> QueryPriceRoot.addContent(new
> Element("SERVICE_NAME").setText(sName));
> Document QueryPrice=new Document(QueryPriceRoot);
> XMLOutputter outputter=new XMLOutputter(" ",true);
> String outReq=outputter.outputString(QueryPrice);
>
> //for looking at xml message
> //System.out.println(outReq);
>
> myrpc.setMethodName("queryPrice");
>
> String rxml=null;
> try{
> rxml=executeSOAPQuery(outReq);
> }catch(GMDQueryException e){
> throw e;
> }
> ......
> return new Price(hPrice,sPrice);
> }
>
> private String executeSOAPQuery(String outReq) throws
> GMDQueryException{
>
>
> myrpc.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/");
>
> //Create a URL object, which represents the endpoint
> URL url="">>
> try{
> url="" URL(servicePoint);
> }catch(java.net.MalformedURLException e){
> throw new GMDQueryException(e.getMessage());
> }
>
> // Add Parameters
> if(!outReq.equals("")){
> Vector myparams = new Vector(1);
> myparams.addElement(new Parameter("inputReq",
> String.class, outReq,null));
> myrpc.setParams(myparams);
> }
>
> //Send the SOAP RPC request message using invoke()
> method
> Response resp=null;
>
> try{
> resp=myrpc.invoke(url," ");
> }catch(org.apache.soap.SOAPException e){
> throw new GMDQueryException("connection error");
> }
>
> //Check the response.
> Parameter result=null;
>
> if(resp.generatedFault()){ //Error Occured
> Fault fault=resp.getFault();
> throw new GMDQueryException("GMD
> Error:"+fault.getFaultString());
> }else {
> result=resp.getReturnValue();
> }
> return result.getValue().toString();
> }
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

Reply via email to