Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • David Peck 534 posts 1384 karma points c-trib
    May 17, 2017 @ 11:16
    David Peck
    0

    Sitemap time out

    The sitemap generated by SEO Checker has started timing out. If I extend the timeout the you do eventually get the sitemap with 3000+ urls in it.

    Do you believe SEO Checker should be able to produce this sitemap in a timely manner, or should I use something custom to resolve this?

    I'm using Umbraco 7.5.7 and SEO Checker 1.9.4.

  • Dave Woestenborghs 2381 posts 6716 karma points mvp c-trib
    May 18, 2017 @ 07:09
    Dave Woestenborghs
    0

    Hi David,

    I just tested this on large site of us with 10000+ content items. The sitemap, although it takes a while to generate it, loads fine.

    Do you have perhaps some UrlProviders in place ? I have seen performance issues with the sitemap in the past when we had several UrlProviders in place.

    Dave

  • David Peck 534 posts 1384 karma points c-trib
    May 23, 2017 @ 14:32
    David Peck
    0

    I do have some UrlProviders. They are pretty quick, but perhaps over several 1000 nodes they create an issue. I'll disable them and check, though I'm not sure what I'll be able to do about it if they are the issue as they are necessary.

    Thanks for the idea!

  • Dave Woestenborghs 2381 posts 6716 karma points mvp c-trib
    May 24, 2017 @ 12:33
    Dave Woestenborghs
    100

    Hi David,

    When using UrlProviders it's good to keep in mind that it will go throught them all until it finds a Url when you do .Url on a content item. You can image that when you have a sitemap with 10000+ items this is a lot of calls to UrlProviders, while probably most of your urls are generated by the default url provider.

    You problably registered them like this :

    UrlProviderResolver.Current.InsertTypeBefore<DefaultUrlProvider, YourUrlProvider>();
    

    What happens when you do .Url in this case is that it will go through all of them before it hits the default provider.

    We had performance issues with this in the past and solved it by replacing the DefaultUrlProvider

    This is the code of your custom default urlprovider :

    public class CustomDefaultProviderUrlProvider : DefaultUrlProvider
    

    { private List allDoctypesWithCustomUrls = new List { // put your doctype aliases here };

    public CustomDefaultProviderUrlProvider()
        : base(UmbracoConfig.For.UmbracoSettings().RequestHandler)
    {
    }
    
    
    public override string GetUrl(UmbracoContext umbracoContext, int id, Uri current, UrlProviderMode mode)
    {
        var content = umbracoContext.ContentCache.GetById(id);
    
        // we don't have a custom provider so just use the default one
        if (content != null && !this.allDoctypesWithCustomUrls.Contains(content.DocumentTypeAlias))
        {
            return base.GetUrl(umbracoContext, id, current, mode);
        }         
    
        return null;
    }
    
    
    public override IEnumerable<string> GetOtherUrls(UmbracoContext umbracoContext, int id, Uri current)
    {
        var content = umbracoContext.ContentCache.GetById(id);
    
        // we don't have a custom provider so just use the default one
        if (content != null && !this.allDoctypesWithCustomUrls.Contains(content.DocumentTypeAlias))
        {
            return base.GetOtherUrls(umbracoContext, id, current);
        }
    
        return null;
    }
    

    }

    It checks we need custom urls for a doctype, and if not it returns the normal url. Otherwise it returns null and our custom url providers will kick in.

    We then registered it like this :

     // replace default url provider
                UrlProviderResolver.Current.InsertTypeBefore<DefaultUrlProvider, CustomDefaultProviderUrlProvider>();
                UrlProviderResolver.Current.RemoveType<DefaultUrlProvider>();
    
                // custom URL providers
                UrlProviderResolver.Current.AddType<YourUrlProvider>();
    

    We saw a drastic improvement in performance when generating things like sitemaps, navigation, overview lists...anything that requires accessing the Url property of content a lot.

    Dave

  • David Peck 534 posts 1384 karma points c-trib
    May 24, 2017 @ 14:04
    David Peck
    0

    OK that's useful. Thank you.

  • Richard Soeteman 3265 posts 9319 karma points
    May 24, 2017 @ 12:11
    Richard Soeteman
    0

    I've tested with 10000 items+ But like Dave said maybe url providers cause issues.

Please Sign in or register to post replies

Write your reply to:

Draft