Starts in:
3 DAYS
4 HRS
36 MIN
49 SEC
Starts in:
3 D
4 H
36 M
49 S
Open Closed

Why do I need the Redis cache for the public website? #6533


User avatar
0
ageiter created
  • ABP Framework version: v8.0.1
  • UI Type: Blazor Server
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no

We have already made several ABP applications with Blazor Server (without Redis Cache). But never with the "Public Website" so far. Now we would like to integrate it and were surprised that the Redis cache is necessary here. We do not have a distributed / tiered application.

I know that this is a prerequisite for the CRM module.

I would be interested to know why the cache is absolutely necessary? What are the reasons for this? Does it have to do with the fact that the Blazor app and the public website share certain things?

I also have the question of how large the cache needs to be if I host the application on Azure... that costs extra money again...

Thanks, Adrian


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

    ok

  • User Avatar
    0
    rafael.gonzales created

    This might not be the good reference you are looking for but right now I'm in the middle of a custom menu provider for ABP and I experienced some issues with ABP + Redis

    Using a multi-level menu environment with Redis, I have experienced a waiting time of almost 6 seconds

    I disabled the distributed locking and removed any reference for Redis in my ABP project and ran the same application and now it runs in milliseconds

    I couldn't take the screenshot before but It takes 2 seconds per key for ABP to get Permissions and Settings from Redis Cache. while in memory it only takes milliseconds.

    While in Redis, ABP takes too much to retrieve information from the PermissionStore cache in Redis. It seems that if you have a more complex menu or multi-level menu or much more information related, It gets complicated for ABP to get from Redis.

    If you look at the end of the following picture, you get high consumption in a single row from Redis.

  • User Avatar
    0
    rafael.gonzales created

    Just one thing to add, it's that those tests I had a response time of 6 seconds when I had many localization pending to be added in the en.json file. After those localization were added the response time changed a lot.

    It's not perfect but it gets better

  • User Avatar
    -1
    rafael.gonzales created

    Hi @maliming

    Is there a way to chat with you? I am also reading the logs of my application and I also see that some keys are repeated and being queried 4 times in each execution also I found some primary keys being cached and I am wondering why ABP wants those PKs retrieved in every request and why there some many repeated keys. I can't share the log because it's a production app but I would like to chat with you about this

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi @rafael.gonzales

    liming.ma@volosoft.com

  • User Avatar
    0
    rafael.gonzales created

    I emailed you maliming

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Ok, let’s discuss this with mail

  • User Avatar
    0
    ageiter created

    I understand that you will discuss this further privately by email. Please just let me know about your findings at the end :-)

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    ok, no problem.

  • User Avatar
    0
    ageiter created

    Any news? (I am writing this primarily so that the question is not closed)

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    rafael.gonzales’ case has nothing to do with yours

  • User Avatar
    0
    ageiter created

    Do I understand correctly that this problem is not being investigated further and that I cannot hope for a solution?

    @rafael.gonzales: Have you found out anything else about the poor performance with Redis?

    @maliming: Can you tell me what your setup is with Redis? Is Redis running locally on your computer? In a Docker container? If so, also with Docker Desktop or something else? Maybe the problem is with the Redis setup.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    My local Redis is running on Docker. It's very fast.

  • User Avatar
    0
    ageiter created

    But not Docker Desktop? It's basically just a UI for Docker... but maybe there are still differences?

    And your test was with an empty list at the time, which is not really representative either.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Maybe you can change the test or running environment to observe the Redis cache performance changes.

  • User Avatar
    0
    ageiter created

    I still need some time for further tests. Can you make sure that the ticket remains open for another month?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The bot closes the issue periodically, it doesn't matter, you can open it anytime you want.

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

  • User Avatar
    0
    ageiter created

    Hi @maliming,

    I finally have some time to take care of a more detailed analysis.

    My test scenario:

    • ABP 8.0.4, entities generated with ABP Suite
    • The tested list "Raumkategorien" is purely generated code ( except the stopwatch)
    • The list has only 4 entries (so the amount of data cannot be the problem)
    • I do the test with an already loaded page. I sort by one column... that's all.

    Extract from class Raumkategorien.razor.cs (to understand the log):

            private async Task OnDataGridReadAsync(DataGridReadDataEventArgs<RaumkategorieWithNavigationPropertiesDto> e)
            {
                var stopwatch = new Stopwatch();
                stopwatch.Start();
                Logger.Log(LogLevel.Debug, "STOPWATCH: OnDataGridReadAsync started");
    
                CurrentSorting = e.Columns
                    .Where(c => c.SortDirection != SortDirection.Default)
                    .Select(c => c.Field + (c.SortDirection == SortDirection.Descending ? " DESC" : ""))
                    .JoinAsString(",");
                CurrentPage = e.Page;
                await GetRaumkategorienAsync();
                await InvokeAsync(StateHasChanged);
                
                stopwatch.Stop();
                Logger.Log(LogLevel.Debug, "STOPWATCH: OnDataGridReadAsync executed in {ElapsedMilliseconds}ms", stopwatch.ElapsedMilliseconds);
            }
            
            private async Task GetRaumkategorienAsync()
            {
                var stopwatch = new Stopwatch();
                stopwatch.Start();
                Logger.Log(LogLevel.Debug, "STOPWATCH: GetRaumkategorienAsync started");
    
                Filter.MaxResultCount = PageSize;
                Filter.SkipCount = (CurrentPage - 1) * PageSize;
                Filter.Sorting = CurrentSorting;
    
                var result = await RaumkategorienAppService.GetListAsync(Filter);
                RaumkategorieList = result.Items;
                TotalCount = (int)result.TotalCount;
                
                stopwatch.Stop();
                Logger.Log(LogLevel.Debug, "STOPWATCH: GetRaumkategorienAsync executed in {ElapsedMilliseconds}ms", stopwatch.ElapsedMilliseconds);
            }
    

    Screenshot of the log:

    Screencast without Redis

    Screencast with Redis

    In the screencast WITH Redis you can also see that the buttons are re-rendered etc. Maybe this will put us on the right track...

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share your test project? liming.ma@volosoft.com

  • User Avatar
    0
    ageiter created

    hi

    Can you share your test project? liming.ma@volosoft.com

    You already have it ;-) Should I send you the link again or can you find my e-mail? Last time (two months ago) you did the test with an empty list. Please enter a few entries this time so that you have a meaningful result.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Yes, these are my test results:

    https://support.abp.io/QA/Questions/6533/Why-do-I-need-the-Redis-cache-for-the-public-website?CurrentPage=1#answer-3a105bf1-ee97-d532-cd54-d4411ab62ccb

    Redis will be slower than the memory cache, that's for sure. There are only a few cache queries and I don't think it's a problem

  • User Avatar
    0
    ageiter created

    But your test was with an EMPTY list! That is not representative. I don't have any problems or delays with an empty list.

    Have you seen my screencast? This delay is not normal and I can't imagine where it's coming from. It's not only the loading of the data GetRaumkategorienAsync() that takes a long time, but InvokeAsync(StateHasChanged); that causes this delay. Why is that?

    For 4 entries in the list 823 ms instead of 61 ms is not nothing and from my point of view not usable. You can see this in the behavior of the UI (see video with the delay and the "flickering" of the buttons). The user experience suffers greatly as a result. I can still do tests to see how it looks with large lists...

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I can't find the test project. Can you share it again? I will test it again.

    Thanks.

  • User Avatar
    0
    ageiter created

    hi

    I can't find the test project. Can you share it again? I will test it again.

    Thanks.

    Sure, I send you an email.

    The following is also interesting: I apparently ONLY have delays with the lists generated with the ABP Suite. There are no such delays with those from the admin area (e.g. audit protocols).

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06