Open Closed

Signin Manager becomes slow. #9435


User avatar
0
abhisheksreesaila created

Provide us with the following info: 🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration button.

  • ABP Framework version: v9.1
  • UI Type: Blazor Server
  • Database System: EF Core (PostgreSQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): NO
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Signin Manager becomes slow.

I have a custom login where I have 1 database per tenant, have a table with user - tenant mapping.

try { var tenantId = user.AssignedTenantId == null ? (Guid?)null : Guid.Parse(user.AssignedTenantId); // get the tenant for the user using (CurrentTenant.Change(tenantId)) { return await base.OnPostAsync(action); ** // this takes 4-6 seconds. ** } }


workaround :

  • When I login to the master (host) site. and then login it is faster. Any reasons why?

-------.. side note ---------- I switched off redis cache - not sure if its related. just mentioning here. it makes the API go slow. I use AZURE REDIS. I tested with a console app and azure redis seems to be fine, fast etc. somehow when i enable it makes all my API go really slow. so switched off.

"Redis": { "IsEnabled": false, "Configuration" : XXXX }


9 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please enable the debug logs and share the logs for your slow HTTP request..

    https://abp.io/support/questions/8622/How-to-enable-Debug-logs-for-troubleshoot-problems

    Thanks.

  • User Avatar
    0
    abhisheksreesaila created

    I enabled openiddict logs.

    Download from here. https://drive.google.com/drive/folders/1Ugr2wnGVpYbY-VK-Z0f_YkT2ieE0Zwyn?usp=drive_link

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The ASP.NET Core still outputs Information logs.

    Can you use the Debug log level?

    var loggerConfiguration = new LoggerConfiguration()
        .MinimumLevel.Debug()
        .Enrich.FromLogContext()
        .WriteTo.Async(c => c.File("Logs/logs.txt"))
    

    Thanks.

  • User Avatar
    0
    abhisheksreesaila created

    ok. sorry. here you go.

    https://drive.google.com/drive/folders/1Ugr2wnGVpYbY-VK-Z0f_YkT2ieE0Zwyn?usp=sharing

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you try to override the IWebClientInfoProvider and test again?

    See https://github.com/abpframework/abp/issues/23029 https://github.com/abpframework/abp/pull/23032

    Thanks.

  • User Avatar
    0
    abhisheksreesaila created

    I added this code in the blazor project. Is that correct? I can try now and test it.

    `

    Using System; using System.Net; using System.Runtime.CompilerServices; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Caching.Memory; using MyCSharp.HttpUserAgentParser; using MyCSharp.HttpUserAgentParser.Providers; using Volo.Abp.AspNetCore.WebClientInfo; using Volo.Abp.DependencyInjection;

    ///

    ///     A high-performance web client info provider that caches browser and device information /// [Volo.Abp.DependencyInjection.Dependency(ReplaceServices = true)] [ExposeServices(typeof(IWebClientInfoProvider))] public class CachedHighPerformanceWebClientInfoProvider : IWebClientInfoProvider, ISingletonDependency { private const int CacheExpirationMinutes = 30; // Longer expiration since UA strings don't change often private readonly IMemoryCache _cache; private readonly IHttpContextAccessor _httpContextAccessor; private readonly IHttpUserAgentParserProvider _parserProvider;

    public CachedHighPerformanceWebClientInfoProvider( IHttpContextAccessor httpContextAccessor, IMemoryCache cache) { _httpContextAccessor = httpContextAccessor; _cache = cache;

    // Initialize the parser provider once _parserProvider = new HttpUserAgentParserDefaultProvider(); } .... ....<< same as code as the link you shared >> ... `` `

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Yes, add it to the Account/Login project.

  • User Avatar
    0
    abhisheksreesaila created

    Ok I added them and its now consistently < 1second. I am not sure if it fixed it or some sort of caching. Usually, when i push a new change, the login tends to be slow again. I will run a few test and get back to you

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    ok

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on September 01, 2025, 08:37