Skip to content

Comment on Ask HN: How viable is F# on Mono for real-life web apps?parent

Comments

If you're using Mono for web hosting then don't use Mono's FastCGI implementation. It's incredibly slow from what I've seen. Instead, use something like evhttp-sharp which has a wrapper for Nancy. Just to give you an idea look at nancy using evhttp ("nancy-libevent2" in the benchmark) vs FastCgi ("nancy" in the benchmark) at http://www.techempower.com/benchmarks/#section=data-r8&hw=i7...

I've tried to contact the folks who are maintaining FastCgi on Mono but the email I sent last week bounced. When you use evhttp though, (at least with C#) there's not a huge performance difference than when using it in Windows.

Awesome, I wasn't aware of evhttp-sharp. On first glance it seems not to provide any Owin middleware compatibility, but it should be easy to do a small server factory that plays with Microsoft.Owin.Hosting and get that out of the box. I've also found https://github.com/Bobris/Nowin a while ago - very fast on Windows, but I can't get it to work on Mono 3.4 on linux, locks on the first request.

If you do make it OWIN compatible or a FastCGI wrapper for libevent that would be awesome. Right now, you need to basically have nginx proxy all the requests to evhttp which probably adds a little bit of overhead over doing it through FastCGI directly.

Edit: Actually from what I've seen, Mono uses epoll/kqueue for async IO which is what libevent uses as well. I think the problem might not be so much that libevent is faster than what Mono can do in plain C# but rather that the FastCGI implementation has some bottlenecks or is not using the most performant APIs available. I haven't had time to profile it though.

I second this. I worked on an ASP.NET MVC product that ran just fine on Mono. This was in the old 2.x days. While I didn't test FastCGI, the founder did, several times. He always told me mod_mono performed better.

I wonder what the TechEmpower benchmarks would look like if they used mod_mono instead of FastCGI.

Thanks, this is really useful!

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.