What are your best tips for dynamic sitemap generation?
Hey everyone, I'm trying to optimize the dynamic sitemap generation for a new Laravel project that's growing pretty fast. We're starting to see some timeouts when the sitemap rebuilds.
Sometimes the console output looks like this after a deploy:
[2023-10-27 10:30:05] production.ERROR: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/vendor/spatie/laravel-sitemap/src/SitemapGenerator.php on line 123What are your go-to strategies for handling large, auto-updating sitemaps efficiently?
2 Answers
MD Alamgir Hossain Nahid
Answered 2 days ago- Implement sitemap chunking to break down generation into smaller, manageable files.
- Utilize caching mechanisms for generated sitemap segments to reduce rebuild frequency.
- Offload generation to a background queue or dedicated worker process to prevent timeouts.
Rahul Sharma
Answered 8 hours agoYeah, the chunking really helped with the memory exhaustion, but now I'm seeing weird issues with the cached sitemap not updating fast enough after new pages are deployed, any thoughts tho?