Huge delay on first browser-request to mono-fastcgi-server4 with Nginx hosted web-application

375 Views Asked by At

We are using mono version 3.10.0 (from $mono --version) and Nginx (1.6.2) and mono-fastcgi-server4 to host a ASP.Net MVC3 web-application running on an Debian jessie linux (ARM - Raspberry Pi).

Basically we seem to have the same problems as described in this question: Huge delay on first browser-request to Mono XSP hosted web-application

When the first request from a browser / website-visitor is made mono-fastcgi-server uses all CPU it can get for up to 120s seconds until the webpage is shown in the webbrowser. This happens after each start/restart of the webserver.

As I understood so far this is quite normal and even the same if your are hosting your website with IIS on a windows server. The main difference is that the Windows server is much faster...

To minimize the startup time this is what I already tried:

  1. Precompile my razor views into dlls by using the "publish website" feature in Visual Studio. This works so far but seems not to reduce the startup-time significantly.

  2. Next thing I came upon was AOTing (Ahead of time compiling) my dlls in the bin folder (see http://www.mono-project.com/docs/advanced/runtime/docs/aot/) I used 'mono --aot file.dll` to precompile my assemblies. Again no performance boost.

  3. Then I found out you can of course also AOT all of the libraries on your system (found here: http://www.mono-project.com/docs/advanced/aot/) by using these commands:

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

    This took quite a long time on may raspberry but - again - the same result.

Am I doing something wrong or missing something obvious?

The author of the before mentioned question said in his last comment about the delay:

Its caused by generating and compiling the razor views which can not yet be pre-compiled. Those files get compiled into /tmp/... which is mapped to memory on the embedded devices and therefore gets lost after reboot. Even worst is that after each restart of the XSP webserver the files will be compiled into a new subdirectory of /tmp. This way re-compiling the razor views happen each time XSP is started.

I think it's It seems that it is the same with me regardless of using XSP4, mono-fastcgi-server and probably also mod-mono when using Apache. (What is not surprising as I think they are all based on XSP - but maybe I'm wrong...)

Now the question mentioned is from 2011...does anybody know if there is a solution to get the webserver to use these precompiled files?

I am thankful for any hint!

0

There are 0 best solutions below