Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why my webservice is so slow  RSS feed

 
Adun Ton
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • 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: 42972
73
  • Mark post as helpful
  • send pies
  • 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 ]
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our Performance forum...
 
Scott Selikoff
author
Bartender
Posts: 4093
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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: 42972
73
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!