2

I'm hosting a simple nancy website (self-host, console app) inside docker on ubuntu 14.04.1 via mono 3.10. Nancy version 1.1

The first time I hit any route, it takes approx. 1 full second to return. Subsequent requests to the same route take ~15ms. I don't just mean the very first hit to the application, I would understand that, but this is every single unique route has a first-hit cost of 1000ms, then all following requests to that route are quick.

The same executable on a windows server (not my local dev-box, but somewhere else on the network) does not have this behavior. Has anyone else experienced this? If so, how do I remedy it without writing a program that just hits every single route once upon startup in order to 'prime-the-pump'?

Thanks in advance.

5
  • Perhaps you're encountering a JIT penalty for the first request? Maybe your files are NGEN'ed on the windows machine? Commented Feb 19, 2015 at 13:23
  • Sounds like a possibility... How could I test that? Is there anyway to NGEN it on the mono machine? I don't build on the linux box, I am FTPing the windows-compiled directory to the server. If I built using mono, would that help? I'll try that now.
    – Chris Ray
    Commented Feb 19, 2015 at 13:26
  • This can help. Commented Feb 19, 2015 at 13:27
  • Built the code inside the docker container, tried mono & mono-sgen, tried mono -O=all --aot (< not sure if I tried that one properly), everything runs with the same behavior as described earlier. First-hit of any route is slooow, all subsequent hits are lightning fast. Not discounting this theory, I just don't know how to proceed with it
    – Chris Ray
    Commented Feb 19, 2015 at 13:48
  • I have the same problem, you found the solution?
    – JPelletier
    Commented Feb 4, 2016 at 20:30

0

Browse other questions tagged or ask your own question.