This commit is contained in:
2020-06-04 19:24:49 +00:00
parent 5adf4aabcf
commit e68d1c48d2
5 changed files with 54 additions and 19 deletions

2
.vscode/launch.json vendored
View File

@@ -49,7 +49,7 @@
"AYANOVA_USE_URLS": "http://*:7575;", "AYANOVA_USE_URLS": "http://*:7575;",
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
"AYANOVA_SERVER_TEST_MODE":"true", "AYANOVA_SERVER_TEST_MODE":"false",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL":"small", "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL":"small",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET":"-7", "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET":"-7",
"AYANOVA_BACKUP_PG_DUMP_PATH":"C:\\data\\code\\PostgreSQLPortable_12.0\\App\\PgSQL\\bin\\" "AYANOVA_BACKUP_PG_DUMP_PATH":"C:\\data\\code\\PostgreSQLPortable_12.0\\App\\PgSQL\\bin\\"

View File

@@ -728,4 +728,14 @@ JAVASCRIPT DOWNSAMPLING TOOL
// if(ministats.Count>0){ // if(ministats.Count>0){
// var v=ministats.Count; // var v=ministats.Count;
// } // }
// } // }
MEMORY LEAK DIAGNOSIS URLS
https://docs.microsoft.com/en-us/dotnet/core/diagnostics/debug-memory-leak
https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-counters
https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-dump
https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-trace
Might be doing GC Counts incorrectly, they don't sync up with the dotnet-counters tool which shows them drop back to zero regularly when I stop burn test
https://michaelscodingspot.com/ways-to-cause-memory-leaks-in-dotnet/
https://bennettadelson.wordpress.com/2013/04/11/using-perfview-to-diagnose-a-net-memory-leak-2/

View File

@@ -51,6 +51,7 @@ namespace AyaNova.Api.Controllers
#if (DEBUG) #if (DEBUG)
[HttpGet("collect")] [HttpGet("collect")]
[AllowAnonymous]
public ActionResult GetCollect() public ActionResult GetCollect()
{ {
GC.Collect(); GC.Collect();
@@ -59,6 +60,25 @@ namespace AyaNova.Api.Controllers
return Ok(); return Ok();
} }
[HttpGet("hammer")]
[AllowAnonymous]
public async Task<IActionResult> GetHammer()
{
//test allocation and cleanup
for (int x = 0; x < 100000; x++)
{
AyContext ct = AyaNova.Util.ServiceProviderProvider.DBContext;
var v=await ct.Widget.Where(z=>z.Serial<100).ToListAsync();
// int i = await ct.Database.ExecuteSqlRawAsync($"select * from aglobalbizsettings");
}
return Ok();
}
#endif #endif
/// <summary> /// <summary>

View File

@@ -49,21 +49,22 @@ namespace AyaNova
{ {
_newLog.LogDebug("Initializing services..."); _newLog.LogDebug("Initializing services...");
_newLog.LogDebug("Profiler"); // _newLog.LogDebug("Profiler");
//https://dotnetthoughts.net/using-miniprofiler-in-aspnetcore-webapi/ // //https://dotnetthoughts.net/using-miniprofiler-in-aspnetcore-webapi/
services.AddMemoryCache(); // services.AddMemoryCache();
services.AddMiniProfiler(options => // services.AddMiniProfiler(options =>
{ // {
options.RouteBasePath = "/profiler"; // options.RouteBasePath = "/profiler";
//in testing only ignorepaths was reliable and worked and docs say it prevents any profiling at all // //in testing only ignorepaths was reliable and worked and docs say it prevents any profiling at all
options.IgnorePath("/auth").IgnorePath("/user").IgnorePath("/docs"); // options.IgnorePath("/auth").IgnorePath("/user").IgnorePath("/docs");
options.ResultsAuthorize = request => // options.ResultsAuthorize = request =>
{ // {
if (request.HttpContext.Items["AY_PROFILER_ALLOWED"] != null) // if (request.HttpContext.Items["AY_PROFILER_ALLOWED"] != null)
return true; // return true;
return false; // return false;
}; // };
}).AddEntityFramework(); // //options.ShouldProfile = request => false;
// }).AddEntityFramework();
//Server state service for shutting people out of api //Server state service for shutting people out of api
@@ -473,7 +474,7 @@ namespace AyaNova
_newLog.LogDebug("Profiler"); _newLog.LogDebug("Profiler");
app.UseMiniProfiler(); // app.UseMiniProfiler();

View File

@@ -28,6 +28,10 @@ namespace AyaNova.Util
{ {
get get
{ {
// System.Diagnostics.Debug.WriteLine((new System.Diagnostics.StackTrace()).GetFrame(1).GetMethod().Name);
// System.Diagnostics.Debug.WriteLine((new System.Diagnostics.StackTrace()).ToString().Substring(56,80));
return Scope.ServiceProvider.GetRequiredService<AyContext>(); return Scope.ServiceProvider.GetRequiredService<AyContext>();
} }
} }
@@ -39,7 +43,7 @@ namespace AyaNova.Util
return Scope.ServiceProvider.GetRequiredService<AyaNova.Api.ControllerHelpers.ApiServerState>(); return Scope.ServiceProvider.GetRequiredService<AyaNova.Api.ControllerHelpers.ApiServerState>();
} }
} }
// https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-3.1 // https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-3.1
internal static System.Net.Http.IHttpClientFactory HttpClientFactory internal static System.Net.Http.IHttpClientFactory HttpClientFactory
{ {