NancyFx / Nancy

Lightweight, low-ceremony, framework for building HTTP based services on .Net and Mono
http://nancyfx.org
MIT License
7.16k stars 1.47k forks source link

Slow to construct NancyHost on Raspberry Pi? #2987

Open robertoldaker opened 4 years ago

robertoldaker commented 4 years ago

My code using Nancy and Nancy Self-Hosting is working fine and does it job great :).

However ... the issue I have is that it is very, very slow to start on a Raspberry Pi. This is the startup code below:-

var uri = new Uri("http://localhost:" + portNum.ToString()); var urlReservations = new UrlReservations(); urlReservations.CreateAutomatically = true; Logger.Instance.LogInfoEvent("Constructing NancyHost ..."); m_host = new NancyHost(uri, new CustomConventionsBootstrapper(), new HostConfiguration() { AllowChunkedEncoding = false, UrlReservations = urlReservations }); Logger.Instance.LogInfoEvent("Starting Nancy Host ..."); m_host.Start(); Logger.Instance.LogInfoEvent("Nancy Host started on port: " + m_settings.PortNum.ToString());

It takes about 25secs to construct the NancyHost object on a rPi 3 and about 45secs on a rPi-Zero.

Any ideas why it would be taking so long and is there anything I might be able to do about it?

I am using v1.4.5 of Nancy and v1.4.1 of Nancy self-host. I cannot upgrade to the latest version since my code would require significant code changes.

Also using mono v6.0.0 on the latest build of Raspbian Buster.

Thanks in advance for any help or advice you can give.