Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASP NET Core project, memory growing. Is GC configured correctly? #1627

Closed
bragma opened this issue Jul 1, 2016 · 4 comments
Closed

ASP NET Core project, memory growing. Is GC configured correctly? #1627

bragma opened this issue Jul 1, 2016 · 4 comments

Comments

@bragma
Copy link

bragma commented Jul 1, 2016

Hi,
I've deployed an ASP NET Core project (.net 4.6.1 as framework) on Azure Web App and I see a continuously growing memory footprint. It seems that every request slowly grows the working set of the app and I really don't know what to do. My first idea is that GC is not working as expected. Here is what happens over time. Any suggestion is welcome, thanks!

unnamed

Here is my project configuration. Notice GC is enabled as a runtimeObject:

{
  "version": "1.0.0",
  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true,
    "define": [ "USE_SWASHBUCKLE" ],
    "xmlDoc": true,
    "nowarn": [ "1591" ]
  },
  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },
  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    },
    "Microsoft.Extensions.SecretManager.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    },
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": [
        "portable-net45+win8+dnxcore50",
        "portable-net45+win8"
      ]
    }
  },
  "frameworks": {
    "net461": { }
  },

  "dependencies": {
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Http.Abstractions": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Authentication.JwtBearer": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Identity": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0-rc2-final",
    "Microsoft.Extensions.Options": "1.0.0-rc2-final",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc2-final",
    "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-final",
    "Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview1-final",
      "type": "build"
    },
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0-rc2-final",
    "WindowsAzure.Storage": "7.0.0",
    "Swashbuckle": "6.0.0-beta9",
    "TimeZoneNames": "2.0.1",
    "NodaTime": "1.3.2",
    "SharedEmailDTOs": "1.0.0-*",
    "Auth0.ManagementApi": "3.1.0",
    "Auth0.AuthenticationApi": "3.1.1",
    "Microsoft.Extensions.Logging.Filter": "1.0.0-rc2-final"
  },
  "publishOptions": {
    "include": [
      "wwwroot",
      "appsettings.json",
      "app.config",
      "web.config"
    ]
  },
  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

I also have an app.config setup and deployed in the approot folder:

<configuration>
   <runtime>
      <gcServer enabled="true"/>
   </runtime>
</configuration>
@bragma bragma changed the title ASP NET Core project, memory growing. Is GC configured correctly ASP NET Core project, memory growing. Is GC configured correctly? Jul 1, 2016
@davidfowl
Copy link
Member

The first course of action would be to get a memory dump and analyze it using either visual studio, windbg, perfview or other familiar tools.

@Kimberleyrene
Copy link

Stop sending me emails

On July 2, 2016, at 23:59, David Fowler notifications@github.com wrote:

The first course of action would be to get a memory dump and analyze it using either visual studio, windbg, perfview or other familiar tools.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#1627 (comment)

@bragma
Copy link
Author

bragma commented Jul 5, 2016

Thanks, I'll keep it in mind. After a few days of observation, I've noticed that under normal condition the application memory working set can vary a lot, slowly growing and shrinking even by 400MB. There were some abnormal situations when trying to POST some large JSON documents (5MB doc) caused huge increases in memory usage even if they were not specifically parsed or required as part of the controller method parameters (I'll submit another question regarding this). I suspect they are caused by some part of the system buffering data.
I still have one question left: how do I know that GC is properly configured and working?

@bragma bragma closed this as completed Jul 21, 2016
@jonbrichoux
Copy link

In code, you can inspect GCSettings.IsServerGC

@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants