Several Questions about BE.Net - before benchmarks

Aug 3, 2008 at 10:07 AM
Hello,

I'm running set of benchmarks comparing different web technologies including php (Dynamic typed language), CppCMS (C++ Compiled) and others
creating typical blog and running load tests on it.
So I want to test ASP.Net as well -- as a presentation of popular web technology based on JIT.
I have several questions

Q1: Support of Mono+MySQL

I'm looking for light, high performance blog system written in ASP.Net running on Mono and capable of using My SQL as its storage backend.
I've seen that previous version of Be.Net should support Mono out of the box and I've seen that 1.3.x had run under apache-mod-mono.
Is this still true for the latest 1.4.5 release, because I don't see mention of mono in features list?

Q2: Does BE.Net includes basic caching?

I mean does BE.Net creates every pages each time it requested or it is capable of caching the data. If so, how does this work? What backend it uses, does
it relate on specific IIS features that may be not available when I run BE.Net using apache mod-mono or running lighttpd + fastcgi + mono?

Q3: If BE.Net supports caching does it cache gzip compressed version of page?

Under high loads gzip compression may become dominant in CPU usage. When I compared PHP I patched its caching module to support caching gzipped pages
that imporved preformance in almost twice.

Q4: MySQL and MS SQL Performance -- it is similar?

In all setups I run I use MySQL database, Lighttpd web server, FastCGI API under Linux 64bit in order to compare rather web development technology then specific
webserver, Database or webserver API. However I just wonder if BE.Net is not optimized for MS SQL and using MySQL may be non optimal (maybe in specific request).
I mean, is there any kind of MS SQL specific optimization that would make comparison using MySQL unfair?

Q5: Do you have any performance tips?

Unfortunatly I'm not familiar with ASP.Net but I still want to do the comparison as fair as I can. Thus if you have any important
tips that would give better performance of the application I would be greatful.

Q6: Is there any markdown plugin?

In all blogs I used markdown as text backend, it is not critical but It would be good to do the same for BE.Net.

About benchmarks: I actually compare different weblog software written in different technologies.
I need this because I develop a new technology: CppCMS -- C++ Web Development Framework (cppcms.sf.net) and I want to
see how can I improve it.
You can see a comparison of WordPress written in PHP with blog based on CppCMS: http://art-blog.no-ip.info/cppcms/blog/post/22

Thank for your attention.
Artyom
Aug 3, 2008 at 11:45 AM
First I am new to BlogEngine.Net, so the developer really need to answer your questions.  I am putting my two cents in but may be totally way off base.  Also, keep in mind my comment in regard to the low level verse high level programming language not I posted in the article you referenced.


Q1:  I am not familiar with Mono or MySQL and would like to see benchmarks of this platform ran on  ASP.NET/MONO as in combination with MySQL/MsSQL Mono has also been reported as inconsistent platform for benchmarking of ASP.NET Applications.  Here is an example of some overhead created by the Mono/Fast-CGI/Asp.Net combination as well as how to fix it.  As far as the support I still see the conditionals in 1.4.5 for Linux and Mono, so it wont' hurt to try it.  From looking at past releases, not every feature of the previous release is rementioned in the successive release

Q2: BE.Net supports some very impressive caching, although not evert.  Which is another thing that may skew your benchmark versus a real word set up.  For Example, a reall client will make up to 20 or 30 request for a single call of a web pages (images, stylesheets, javascripts, etc).  Be.Net will actually combine the all javascripts into a single file and cache it to the client,  Your scripted benchmark will probably overlook these real world benefits.  Futher more ASP.NET has some awesome cacing utilities built into that BE.Net may not take full advantage of out of the box. There are entire books written on Performance Tuning ASP.NET Applications. As far as IIS Yes and No.  There is the ability to cache content within IIS, but ASP.NET does not rely on that.  However, in the real world using High performance Applications, you might enable both. Why?? Becuase no matter what web server your running, the web server must first intercept the request and decide who to hand it off to.  The the Dll's or EXE responsible for handling that request is loaded and the request is passed on. When Caching is enabled in IIS, you can eliminate that step and prevent the calls to the ASP.NET handler in the first place.  You could probably gain the two best performance gains in any ASP.NET Application by setting the output cahce for every page, as well as disabling the view state. Thhe viewstate is not disable by default becuase some controls rely on it to store post back data.


Q3:  Yes, Be.net does support GZIP Encoding as well as DEFLATE; However Mono has an issue with GZIP, so unless the mono build is compiled with the correct DLL's it will complain when running BE.NET.  For that reason, GZIP is disabled by default in BE.NET (See blogSettings.CS).  Additionally, when ran IIS can also be used as the compression mechanism.

Q4:  Again I would like to see Be.Net Benchmarked on both MySQL and MsSQL so I know the answer to the MySQL vs MSSQL answer.  However, the other things I would be concerned about is the ASP.NET application going to run on a 64 bit processor??  ASP.NET is CPU dependant I believe.  Additionally, as I pointed out at the beginning of this post, there are several perfomance issues that have been documented running ASP.NET on the setup you suggest.  Further, I may be wrong, but I am pretty sure that if I where to run the same benchmark on My own PHP/WordPress/MySql installation on my Windows 2003 server against the same set up on a *nix box, the *nix box will win.  Why?  we could speculate, but I would make that conclusion based on the fact that PHP(Perl) and MySQL are natively optimized to run on Linux.  The Windows version is merely a port that is probably full of hacks that sacrifice performance for interoperability

Q5:  Performance TIPS:  Like I said there are entire books devoted to this subject.  But for starters, enable the output cache, disable the viewstate. Disabling the session state also boost performance, but I am not sure if that will make Be.Net compain.  In you fast CGI setup, make sure the socket for .aspx is mapped directory to the FASTCGI daemon. Its really not going to be fair if MONO starts incurring a whole bunch of unneeded overhead, outlined in the links above.  I have not even looked at the setup scripts for the SQL, but that has a lot to do with performance.  Setting up the correct Indexes and Primary keys are obviously imortant.  I would imagine(and I may be wrong), the MySQL scripts do no take this into consideration.  For the Web Side:  Asp.Net has two main types of caching. Output Caching and Data Caching.  Output caching caches the rendered HTML, and data caching, well that cache the data used to render and databound weboontrols. If you are going to really tune an application for high performance, you use both.  I am not sure how much caching is built into BE.Net.  But If I where to perform a performance based bench mark, I would A) set the pages up to use output caching and B) make sure I used data caching wherever it made sense.  The Project Developers can provide you with the specifics in regard to BE.Net much better than I can.  To Output cache the contents of a page, you would simply paste the following code to cache it for 20 minutes
<%@ OutputCache Duration="20" VaryByParam="None" %> 

at the top of the ".ASPX". Data cache is a little more complex, and require mechanisms to add and remove data to the applications cache.
The most critical part of any application to implement caching is at the datalayer. Yes HTTP compression and OutPut Caching can also vastly improve perfomance, but the main reason for the performance gain in dynamic apps is that you don't have to hit the database on every page load.

Q6: Again, I am just getting familiar with this project and do not know all of the plugins. I also don't know what a markdown plugin is? You mention text


Frankly, I think your wasting your time trying to prove what the rest of the world already knows. A well built CPP app will destroy a way built PHP or ASP.NET app any day of the week.
Aug 3, 2008 at 1:08 PM
R1: First of all thanks for this points, I'll check them in order to make sure it works well. I think the point of 500 Errors in second message is known to me I think this is connected
to lighttpd behavior. I think the answer may be MONO_FCGI_MAXREQS MONO_FCGI_MAXCONNS -- allow process work with several connections. I had some similar
issues when run CppCMS with lighty -- you need have high concurrecny support.

R2: I understand that the comparison not 100% true, on the other hand all static data can be served by webserver itself without application. However I still compare applications.

R3: Ok I'll check this, however as I can see this relates to quite old version of mono.

R4: I don't try to prove MS SQL vs MySQL or mono vs .net. My major question what is the general difference +/- 20% not so matter.

> A well built CPP app will destroy a way built PHP or ASP.NET app any day of the week

Beleve me or not, may still thinks other -- one of the "known" issues is that DB is major bottleneck that is not quite correct.

>Yes HTTP compression and OutPut Caching can also vastly
>improve perfomance, but the main reason for the performance
>gain in dynamic apps is that you don't have to hit the
>database on every page load.

This is not quite true. Under high loads of 200-300 pages per second compression is dominant. Also, DB is not as "slow" as
many generally think, I was capable of creating about 1000 typical requests per second from MySQL without problems ---
meaning if I need 7 queries for certain page and its creation would not cost me I would got abot 1K pages per second.

So data caching is important but SQL is not dominant bottle neck

> <%@ OutputCache Duration="20" VaryByParam="None" %>

So only I need to add this to relevant aspx pages? Is there some kind of "switch" in Be.Net in order turn it on?
I mean does BE.Net has option to enable/disable cache?

Thanks
Aug 4, 2008 at 1:35 AM
As far as the output cache, I an not that familiar with Be.Net. I just learned about it about a week ago.  The only reason I know as much as I do about it,
is because I have written the entire C# code base in Visual Basic so VB developers can use the platform.

You can diagrammatically control caching for any asp.net application in the file called "Global.ASAX". This contains application wide settings.
Again there are several ways you can set the caching, like at client, server, varybyparam (querystring).  For example, if you want to set caching for every
page on a web set, using the server's memory as the cache, in the Application_BeginRequest in the Global .ASAX you would set it as follows

protected void Application_BeginRequest(Object sender, EventArgs e)  

{

Context.Response.Cache.SetCacheability( HttpCacheability.Server);

Context.Response.Cache.VaryByParams.IgnoreParams = true;
// Ignore params says to ingore query strings, so for default.aspx?post=hello and default.aspx?tag=/blog
// the the querystring would be ignore and the same cached content would be served for both,
// which is usually no good

Context.Response.Cache.SetExpires(DateTime.Now.AddSeconds(count));

...

}

Aug 6, 2008 at 11:39 AM
I tried to add <%@ OutputCache Duration="60" VaryByParam="*" %> however I got no effect.
Tryed both default.aspx and post.aspx. The performance didn't change.
Do I miss something? What should I add when where exactly?

Thanks.
Aug 7, 2008 at 7:24 AM
Someone? where should I add <%@ OutputCache Duration="60" VaryByParam="None" %> in order to
make caching work?
Aug 7, 2008 at 7:24 AM
Edited Aug 7, 2008 at 9:47 PM
Add it to add the very beginning of the page, on the line below the <%@page ...%> directive....

Actually, it really shouldn't matter... you can test by adding this line to the page



and refreshing the page in your browser. The time should stay the same until the application is restarted or cache expires....







Aug 7, 2008 at 8:04 PM
OK, it is something to do with mono, I created simple "time page" with cache and tested it on windows under IIS and dev server -- worked well. Under mono cache
just does not work and I have no idea what to do.

Second, there are problems with performance stability as it was shown in the article -- performance get slower and slower.

I think, mono should get little more mature before I'll start benchmarking it.

Thanks a lot and best regards.

Artyom
Aug 7, 2008 at 9:51 PM
As far as Mono goes, well that's why I pointed out the mono issues to begin with... However, have you though about testing on IIS?  You can run PHP and MYSQL on IIS.  I do it for my WordPress Blog.
Aug 8, 2008 at 5:25 AM
> However, have you though about testing on IIS?
> You can run PHP and MYSQL on IIS.  I do it for my WordPress Blog

I have two reasons I'm not doing this

  1. I have no windows at home to run such setup,
    only in virtual machine for very special cases,
    but it is not good for performance testing
  2. I rather interested in running ASP.Net against CppCMS and
    it runs only at POSIX platform (I use many features like fork and so on)
    However running CppCMS under cygwin (POSIX windows layer)
    have huge performance drawbacks. So actually I need to test such
    setup on Dual-Boot I don't have.
Thanks for your help once more.