I know this may be hard to answer out of context, but are there any gotchas or things to be aware of when using AsParallel within a Sitecore scheduled task?

We have a scheduled task in our solution which generates an XML feed of all the products in our site (~500 products, each with ~10 subitems). Will using AsParallel to loop over these give much of a performance benefit, or could this actually cause problems in other areas due to using up all available threads?

I know we can do timing/profiling locally to analyse the situation, but this does not really account for the impact to a CM/CD server which would be doing other stuff as well.

PS we're using ContentSearch to retrieve the products, not Sitecore query before anyone tells me off! ;-)

  • 1
    Beware your context and the limitations of context switchers. sitecore.stackexchange.com/questions/8025/…
    – Mark Cassidy
    Commented Jul 19, 2018 at 8:37
  • If you are using ContentSearch then it should be very quick to generate anyway (obviously if you have to GetItem then that'll have an impact). I've used this for generating sitemaps and the time to generate was negligible. If you're generating the file to disk/media library, then even less of an overall impact (rather generate on request)
    – jammykam
    Commented Jul 19, 2018 at 16:25


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.