abpframework / abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.98k stars 3.46k forks source link

ABP uses significantly more memory than a regular .NET project #20932

Open MJSanfelippo opened 2 months ago

MJSanfelippo commented 2 months ago

Description

Hi, we've been noticing that ABP uses significantly more memory than a brand-new project that doesn't use ABP. This is in apps with basically nothing in them, and that see very little use. This is even more prevalent if using server garbage collection mode (which is default in modern aspnet core). When using server gc, they would balloon up to several gigabytes for basically no reason (no memory leaks in our code, we checked). We switched the first one to workstation gc mode which helped bring the memory down, but it's still way too high for no good reason. For example, here is a project that uses ABP that sees basically no use because it's our dev server:

{66C5F603-3CE2-4A8F-B721-6D7E975D0D83}

And here is a project that does not use ABP that sees the same amount of use (that is, basically none, also on our dev server). Also note this is using server gc, not workstation, and it's still using significantly less memory.

{89D7DC66-EE1C-4F78-BE89-14A5222C9E9B}

As a note, both have auth servers and both have a web api. The startup time of ABP is also much longer than a non-abp project.

BringerOD commented 2 months ago

+1

jasenf commented 2 months ago

Just chiming in here..

what's the expectation?

abp is the exact opposite of a bare bones "regular" .net project. It's a full on framework and packaged application. It has countless internal services along with third party libraries injected to provide hundreds of non-standard out of the box capabilities. Those libraries are naturally going to take up space.

jasen

MJSanfelippo commented 2 months ago

Just chiming in here..

what's the expectation?

abp is the exact opposite of a bare bones "regular" .net project. It's a full on framework and packaged application. It has countless internal services along with third party libraries injected to provide hundreds of non-standard out of the box capabilities. Those libraries are naturally going to take up space.

jasen

The expectation being that it uses much less memory. What could it be doing behind the scenes that's making take up 100s to 1000s of mb more memory, especially when the app is not even being used? I'm using very few of the hundreds of non-standard out of the box capabilities that you're talking about - we really just use the built-in auth server and localization from ABP for 99% of our apps, including the one I posted above.

jasenf commented 2 months ago

Just loading up all the libraries and assemblies getting ready for usage?

I'm sure that could be verified with some simple memory snapshots?

I don't think it really matters if you are "doing anything". The amount of overhead required to orchestrate the large number of libraries loaded up during startup are just going to have a big impact. I could be totally wrong, and happy to have the abp.io team say otherwise, but my assumption is this is just the "cost of doing business" with such a large framework as abp.io.

jasen

MJSanfelippo commented 2 months ago

I'm not specifically talking about startup performance, although that is something I feel could be faster. The point of the issue is about the high memory usage after the app has started up, despite seeing basically no requests.

jasenf commented 2 months ago

I feel ya. I think the two issues are probably related: lots of assemblies to warm up. Nothing related to requests (thankfully, since we don't want all that stuff happening during end user requests).

MJSanfelippo commented 2 months ago

For sure - I recognize I don't have any specifics (I don't really want to be the one to debug what in ABP is eating up all that memory, I don't have the time and I don't feel that it's my job to do it), but figured I'd put it on the ABP team's radar as something to care about.