0

I have an ASMX Web Service, which I am serving over HTTPS. After some testing, I arrived to the conclusion the Web Service would be intolerably slow in a real-world scenario.

I understand that the overhead of using HTTPS is unavoidable, but I would like to know how I could optimize this Web Service. The first thing I have noticed is that, most of the time, my Web Service returns lists of things, for example (not taken from the actual Web Service):

<Cars count="2">
  <Car brand="Mercedes" registrationplate="612M0D0"/>
  <Car brand="BMW" registrationplate="4RS-73CHN1C4"/>
</Cars>

(Usual real-life values of count are around 40-50.)

Thus, both the element's type's name (in this example, Car) and its attributes names (in this example, brand and registrationplate) are repeated too many times. All of this suggests compressing the SOAP response before sending it would a good idea. But I don't know to do it. Does anybody know?

isekaijin
  • 19,076
  • 18
  • 85
  • 153

1 Answers1

1

Have you determined what is slow?

  • The volume of data
  • The number of requests
  • Time spent accessing a data store
  • Time between request and response

etc.

The first step in optimisation is to get metrics and then once you have these attack the ones that matter. For example a call to the function may be 1ms but if you call it 2000 times the delay may be 2s. So in this case attacking the number of calls may be in order.

I suggest using a tool like DotTrace to give you indicators.

Edit See this so question : HTTP vs HTTPS performance

Community
  • 1
  • 1
Preet Sangha
  • 64,563
  • 18
  • 145
  • 216
  • Neither the number of requests nor the time spent accessing a data store are the problem. I know this because the Web Service performed quite acceptably when it was tested over plain HTTP. The problem is mainly the volume of data (operations whose responses returned more data have always been consistently slower) and the time it takes to encrypt/decrypt SOAP requests and responses (which is also directly proportional to the volume of data). – isekaijin Mar 30 '11 at 22:08
  • Finally, my test setup (dev machine = Web app's Web server = Web Service's Web server) is **very** unlike a real-world scenario (Web app's Web server possibly hosted in another country, Web Service's Web Server necessarily hosted locally, since it must access a database that cannot be exposed online), so numerical metrics would be worthless. I am not developing some Web application meant to be used by everyone with an Internet connection, so testing everything would be... uh... overkill. – isekaijin Mar 30 '11 at 22:14