C # MVC 5.1 Razor 3.0 Performance

I am using ab.exe (apache scanner) on the local developer's machine, i7 / 8gb ram / windows 8.1 pro quad core, using IIS 8.5

I am getting some unusual results, and I cannot understand this problem. First of all, my web.config has debug = false, trace = false and the application compiles in release mode. Release mode monitors continuous deactivation, while constant debugging is disabled and optimization is enabled. Insecure code disabled.

I tried several different settings for ab, but currently I use them:

ab -c 150 -n 1000 -s 5 http://localhost:15007/partials/recipes/_recipe-930.html
ab -c 150 -n 30000 -s 5 http://localhost:15007/partials/recipes/_recipe-930.html > log-currentsite.txt

ab -c 150 -n 1000 -s 5 http://localhost:15008/razor
ab -c 150 -n 30000 -s 5 http://localhost:15008/razor > log-razor.txt

Yes, I went overboard to warm up - but it won’t take long :)

The site at 15007 is the current live site in live build mode on the same local computer and the same IIS with all the same application pool settings (default) that the site 15008 has only a simple basic code:

Route Configuration:

routes.MapRoute(name: "Razor", url: "razor", defaults: new { controller = "Page", action = "Index" });
routes.MapRoute(name: "ASPX", url: "aspx", defaults: new { controller = "Test", action = "Index" });

Controllers

public class PageController : Controller
{
    public ActionResult Index()
    {
        return View();
    }
}

public class TestController : Controller
{
    public ActionResult Index()
    {
        return View();
    }
}

~ \ Views \ Page \ Index.cshtml

@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title></title>
</head>
<body>
    <div>
        Testing
    </div>
</body>
</html>

~ \ Views \ Test \ index.aspx

<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title></title>
</head>
<body>
    <div>
        Testing
    </div>
</body>
</html>

However, right now I turned off aspx testing and turned on only the razor:

public class MvcApplication : System.Web.HttpApplication
{
    protected void Application_Start()
    {
        ViewEngines.Engines.Clear();
        ViewEngines.Engines.Add(new RazorViewEngine());   

        AreaRegistration.RegisterAllAreas();

        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
    }
}

Results:

log-currentsite.txt:
Requests per second:    1896.31 [#/sec] (mean)

log-razor.txt
Requests per second:    1163.77 [#/sec] (mean)

And just to show you the comparative difference when ASPX and the static txt file with the letter "a" in it were included in the project:

ASPX
Requests per second:    8086.47 [#/sec] (mean)

Static File:
Requests per second:    7503.54 [#/sec] (mean)

ASPX code (as mentioned above, the same project as a razor, but without code that removes the aspx rendering engine) seems to be faster than a static file search in the same project. This will make sense since there will be less IO overhead for checking / file stream.

, ?

, , - MVC4/Razor2, - MVC5/Razor3, , , , , ( , ), // snipets ( )

, MVC5/Razor3, MVC4/Razor2 , , ~ 2 /, , live , .

, , ​​ aspx /config/project? , , ? - ?

+3
1

, , , , , .

, Views web.config! v2 v3. , NuGet . . , ? , .

web.config 3.0.0 , :

Razor:
Requests per second:    9696.84 [#/sec] (mean)

: D

EDIT: , MVC4/Razor2 MVC5/Razor3, RPS :

From:

log-currentsite.txt:
Requests per second:    1896.31 [#/sec] (mean)

To:

log-currentsite.txt:
Requests per second:    5063.96 [#/sec] (mean)

, - , , , , mvc , / - , id .

+3

All Articles