• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Why my webservice is so slow

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I build a WebService project with JBuilder2006+Tomcat4.1,
a very simple one,add two numbers together,and return the result
and it's quite slow,
taking 2 to 3 minutes to return the result of 2+3,
what a nightmare.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A functionality like that shouldn't take more than 50ms or so. What timings have you done to figure out where the delay is coming from? Is it client-side processing, network delay or server-side processing? Could there by any startup times involved (of the web app or any dependent libraries)?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
from Arun Ton:

This is my main in the test Client,
it will call the webservice and get the result.
public static void main( String[] args ) throws Exception{
CalculatorService locator = new CalculatorServiceLocator();
Calculator service = locator.getCalculator( );
System.out.println( "2 + 3 = " + service.add( 2, 3));
}

The first two lines are quite fast,
it becomes very slow when comes to service.add( 2, 3);
what may be the reason do you think.
Many thanks.



That is the line that calls the service, which means it could still be any of client, network and server, as I said in my message. You need to take timings
1) before the call on the client side
2) when the call arrives on the server side
3) when the call returns on the server side
4) when the call returns to the client side
For starters, using the value from System.currentTimeMillis would be sufficient (assuming that client and server are clock-synched). Once you have these numbers, one can start to speculate where the problem is.
Which server are you using? Are there any error messages on the server?
[ October 31, 2005: Message edited by: Ulf Dittmer ]
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to our Performance forum...
 
author
Posts: 4342
40
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whats the network between the client and server like? Try running your test where the client and server are on the same computer and see what you get. If you still get 2-3 minutes there's likely something an error somewhere in your code or setup, otherwise its just a networking cost (which is why code should always be optimized to reduce networking/database costs at all costs!)
[ October 31, 2005: Message edited by: Scott Selikoff ]
 
Adun Ton
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now,I am using jbuilder2006,and the webserver Tomcat5.0,
later,I will try to deploy it on weblogic 8.1,
I don't think it would make much difference.
 
Adun Ton
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It shall not be the problem of the net,
I setup the server on my own machine.
Is there a way to time the transactions at the server side?
And no database is used.
[ October 31, 2005: Message edited by: Adun Ton ]
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Is there a way to time the transactions at the server side?



Just get the current time when your service method is entered and before it is exited.
 
I am Arthur, King of the Britons. And this is a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic