Huge delay on first access to a web browser running a Mono XSP web application

We use the Mono (2.10) XSP4 web server to host the ASP.Net MVC3 web application running on open embedded Linux (ARM). It takes several seconds to start up XSP4 until it is ready and accepts requests. No problem with this so far.

But when the first request is made from a browser / web visitor, XSP4 uses the entire processor, it can take about 55 seconds until the web page is (successfully) displayed in the web browser. This happens after each start / restart of XSP.

My first thought was that it was a compilation of the entire web application right on time. Therefore, I built a deployment package that contains only binary .css, .js and views (.cshtml) files. He worked, but still had this huge delay.

Then I tried to precompile this web application using Visual Studio (as mentioned in some Mono release notes). The site worked well again, but a huge delay was still present.

Some questions that are actually on the mind:

  • Does anyone know what the XSP web server does when the first browser request comes in? Is this just-in-time compilation even if its pre-compiled web application?
  • Why does he do it after each run again?
  • Can a huge delay be reduced at all?
  • Is it possible to reduce the huge delay, so it only runs in the very first browser request after updating the web application (cached between subsequent XSP runs)?

Any help / ideas would be great.

Update:. In the meantime, I found that the delay was caused by the creation of the Mono / ASP.Net compiler compiler and the compilation of MVC3 razor views into / tmp / root -aspnet ... /, which is mapped to memory and therefore not constant. Now I'm looking for a way to control where XSP4 / Mono.WebServer / Mono-Asp.Net stores these compiled files. If anyone is familiar with this, let me know; -)

+4
source share
1 answer

This could be assembly overhead (which does not depend on what the precompilation does). You can check if AOTing supports system libraries acceleration:

mono --aot /usr/lib/mono/1.0/mscorlib.dll for i in /usr/lib/mono/gac/*/*/*.dll; do mono --aot $i; done 
+1
source

Source: https://habr.com/ru/post/1381480/


All Articles