Latency issues when self-hosting a simple NancyFX HelloWorld application running Mono

Background

I am testing the NancyFX environment by running a simple HelloWorld example under different conditions.

public class IndexModule : NancyModule
{
  public IndexModule()
  {
    Get["/"] = _ => "Hello World!";
  }
}

      

The example seems to work fine on both Windows and Linux, the problem is Mono response times. On Windows, the HTTP response takes aprox. 3-4ms, whereas the same code under Linux (Mono) always takes 200ms +. After some additional testing (and moving to ServiceStack AppHost) the problem persists, so I'm guessing it has something to do with Mono. Any ideas?

HTTP response (CentOS 6.5, Mono 3.10)

centos_mono_nancyfx_http_response

Test results

OS                  Runtime          Response time    Location
Windows 7           .NET 4.5.1       3ms              Local
CentOS 6.5          Mono 3.10        200ms            Local
Ubuntu 12.04 LTS    Mono 2.10.8.1    295ms            Remote

      

Other

Source

Profile dump

+3


source to share


1 answer


Oddly enough, if you put a reverse proxy on top of a self-serving application, the latency issues go away.

This is where the nginx proxy_pass config is used:



# /etc/nginx/virtual.d/nancydemo.conf

server {
  listen 80;
  server_name nancydemo.local;
  root /media/sf_dev/nancydemo/bin/Debug;

  location / {
    proxy_pass http://127.0.0.1:1234;
  }
}

      

0


source







All Articles