Infocaster / UrlTracker

An Umbraco package that tracks 404 not found results and helps you redirect visitors to the right page
https://infocaster.net/wat-we-doen/umbraco-plugins/301-url-tracker
MIT License
17 stars 12 forks source link

Load-balancing redirects not working on subscriber #172

Closed karltynan closed 4 months ago

karltynan commented 7 months ago

Describe the bug Using version: 10.3.3 (Umbraco 10.8.3)

When used in an Umbraco load-balanced configuration (1x admin/scheduler web app, 1x subscriber web app with 3x instances) UrlTracker works as expected on the scheduler web app, but the subscriber web app does not get the updated redirects until the server is restarted.

Is load-balancing supported?

To Reproduce

  1. Make a redirect change on a scheduler web app
  2. Test the redirect on a subscriber web app

Expected behavior Redirect should happen on both the scheduler and the subscriber web apps without a restart.

D-Inventor commented 7 months ago

Hi @karltynan ! Thank you for reaching out!

It appears that the memory cache on the subscribers doesn't get purged upon changes to the redirects. This is a known issue that I wish to resolve, but have not had the capacity and means to fix myself. That is to say: I'm looking for a community contribution to help me implement it.

If you're in need of a quick workaround, you can disable the memory cache using the appsettings. You can read more about this in the readme. This will come at a small performance cost.

If you're willing, we'd be very grateful to receive a contribution to support cache purging across multiple instances. I've described how this should be done in another issue here.

Looking forward to hear from you!

karltynan commented 7 months ago

Thanks for the response!

Unfortunately, I do not have enough knowledge to even attempt contribution on this, but I will look into it and reach out to others and see if they can assist where possible :) Also happy to help testing if someone else does provide a solution.

Should I set EnableInterceptCaching to false in the short-term? What kind of "small" performance hit do you expect that would be?

Many thanks.

D-Inventor commented 6 months ago

Hi @karltynan ! I overlooked your additional question. Answer is: "it depends". For each incoming request, the URL Tracker would make 2 or 3 database queries. These queries are usually decently quick if you have a proper SQL Server database. In my experience, a page without caching on the URL Tracker takes about 100 to 200ms to load.

That being said: I'm working on this as we speak, together with a new "active" cache that will eliminate all database traffic. I hope to have this finished before the end of next week. I'll give another signal when I have a beta.

karltynan commented 6 months ago

Wow, an "active" cache sounds really exciting too! Let me know if you'd like us to beta test anything for you.

D-Inventor commented 6 months ago

Hi again. It is that time: Version 10.4.0-beta0001 should be released on NuGet any minute now with a fix for your issue. I would love it if you could try it out and see if this version fixes your issue!

Since you're interested in the new active cache feature, I would highly appreciate it if you could give that a try as well. The active cache is disabled by default, but you can enable it by adding this config to your appsettings.json file:

{
    "UrlTracker": {
        "Caching": {
            "Memory": {
                "EnableActiveCache": true
            }
        }
    }
}

What I'm mainly interested in is:

However, any feedback you have is very welcome :blush:

D-Inventor commented 4 months ago

This issue has been solved in versions 10.4.0 and 13.1.0 for Umbraco 10 and 13 respectively. Since Umbraco 11 and 12 are STS and a higher LTS version is available, these versions won't receive an update anymore.

I'm closing this issue.