0

My website using MVC 5 with razor view. when i publish my website this is run very slow in first time and very fast in 2nd 3rd time.

But after one day i not run (access) to my page. this is run very slow like first time (20 to 30 second).

i don't know why.

tereško
  • 58,060
  • 25
  • 98
  • 150
lecuong92
  • 43
  • 7
  • The first time is because it takes a while for the environment to kick in. There are plenty of resources to research this (there is even an `IISOptimizer` class out on the internet somewhere in relation to this). Its just the way it is .. your views and code need to be compiled/warmed up (for now..) so the first request will always be slow after a deployment. Regarding "After one day its slow" issue - that could be a few things: your code creating lots of garbage, or the fact you're on shared hosting and your Application Pool is being recycled.... Can we have more information to help you? – Simon Whitehead Jul 07 '15 at 02:23
  • also try http://stackoverflow.com/questions/13386471/fixing-slow-initial-load-for-iis or http://programmers.stackexchange.com/questions/97538/why-after-each-restart-my-local-net-sites-take-time-to-load-for-the-first-time or just google your question. – Mark Miller Jul 07 '15 at 02:30

1 Answers1

0

It will always be slow the first time because unless you have IIS setup to be always on, the first application hit does some initialization work. For every request after, it will be faster since the initialization work is already done.

Brian Mains
  • 50,520
  • 35
  • 148
  • 257