0

I have a wcf rest api project with a lot of service contracts (almost 20) and each service contract has X method (from three to even twenty methods).

I host it inside IIS7 and register all the routes threw the Global.asax (not using .svc files).

Each time i recycle the IIS (after each installtion of new code) , the first request to each route is very slow (from 30 seconds until 2 minutes in some of the routes).

Now i want to solve this problem and rebuild the routes and their methods amount. I tried looking for the ideal amount of operation contract in each service contract and ideal amount of service contracts but could not find an appropriate answer.

Is there an ideal solution to solve my problem?

FelProNet
  • 689
  • 2
  • 10
  • 25
  • I read this post before and it is not the same. My app is recycling after i deploy my project dlls to the folder the the iis works with. And my question is different, i am asking about the best way to divide the service contracts and operation contracts so the warm up process after the recycle process will be ideal. – FelProNet Oct 21 '14 at 13:13

1 Answers1

0

After reading some more and doing some tests on my api i got to some conclusions:

  1. There is no magic number for the service and operation contracts. But sometimes , spliting one big service contract (one with 20 methods for example) that takes too much time to load after recycle, is a good idea that can help.
  2. If the warm up time after recycle is too long (for some applications 10 seconds can also be too long) you can use some patterns to avoid it. Example for those patterns

The main idea of those patterns is to avoid users from waiting to request. One of the ways to solve it is using load balancer and each server we deploy will be temporary removed from the load balancer and all the requests will go to the other servers. In those patterns i also found a solution to let users access servers with older versions while the new version is being installed on the other servers.

Hope it will help someone beside me.

FelProNet
  • 689
  • 2
  • 10
  • 25