B
B
beduin012014-09-08 13:49:53
ASP.NET
beduin01, 2014-09-08 13:49:53

Why do ASP.NET MVC applications consume so much memory?

Actually there is a website in PHP and a similar news site in ASP.NET MVC.
Site on PHP judging by the task manager eats 5MB of memory
Site on ASP.NET 200MB
Why is this happening? ASP.NET site is normal and not crooked.
By the way, why does PHP have several copies of PHP-CGI.exe sitting in memory?
Is it possible to somehow reduce the memory consumption of the site? Site traffic is the same.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Vsk, 2014-09-08
@viktorvsk

Ruby and python (and, I think, asp as well) are loaded into the "production mod" once and hang in memory. That is, all classes and constants are loaded and do not require recalculation (in the general case). In PHP, for each request, a separate process that dies upon completion.
There are various variations, such as fastcgi phpfpm, as far as I know, which try to delay this process longer.
These approaches have their pros and cons. Don't optimize anything much until you realize it's a bottleneck.
PS A similar site on PHP and ASP.net MVC does not climb into any gates, if only because PHP is a language, ASP.net MVC is a framework.
PSS To say that two sites are the same is to say nothing
PSSS ASP.net site is normal and not crooked - this is also a finger in the sky
And to say today that 200 MB on the web is a lot, it's very hard.

A
Alexey, 2014-09-08
@HaJIuBauKa

How an ASP.NET site works. Approximate picture:
All business logic code lives in dll (these are classes of controllers, models - in a simple case). Loaded into memory as needed. You can say that on request. Further, this code is not unloaded from memory to speed up the site. That is why it takes up more memory than a PHP site.
How a PHP site works.
The code is interpreted on the fly. All code. Yes, PHP can be configured to work with a script cache, such as MemCache or something similar. But it's still a little different. The principle will still be the same - request, interpretation, compilation, response. That is why large PHP frameworks without a configured script processing cache work slowly.
My opinion is that the ASP.NET architecture is faster out of the box. This applies to the business logic written in the classes of your application.
About a DB conversation separate.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question