Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report generation performance improvements #310

Merged
merged 20 commits into from
Dec 23, 2023

Conversation

jesseleite
Copy link
Member

@jesseleite jesseleite commented Dec 15, 2023

This PR massively improves report generation performance overall (up to 10x faster compared to current version 5.3.0, and up to 4x faster compared to master branch right now). It also adds the ability to chunk generation into smaller jobs for super large sites with thousands of entries.

For example, report generation on 5.3.0 (current version) for even 1000 pages is 60+ seconds with a request timeout...

CleanShot 2023-12-23 at 02 03 25

But with this PR, 1000 pages takes me ~7 seconds, which is about 10x faster 🏎️...

CleanShot 2023-12-23 at 02 06 10

But where this PR really shines is when generating reports for massive sites with thousands of entries, which you can't even do on 5.3.0 (as shown above in our 1000 page example).

On master (untagged), we can at least generate a report for 5000 pages, but it takes me about ~52 seconds...

CleanShot 2023-12-23 at 00 53 27 2

With this PR though, the same 5000 pages takes about ~29 seconds, which is nearly 2x faster 🏎️

CleanShot 2023-12-23 at 01 12 38

And if I enable async queue driver w/ 5 workers (chunked in jobs of 1000 pages each), the report generation endpoint takes about ~13 seconds, which is about 4x faster compared to master, and not even possible on 5.3.0 🏎️

Configuration

I have made the chunk size configurable in config/statamic/seo-pro.php under reports.queue_chunk_size, so that users can balance chunk size vs. worker count how they like.

Note on CPU

Of course your mileage will vary. It's pretty CPU intensive when generating a report for this many entries. The above numbers are just locally on my M1 Macbook.

@jesseleite jesseleite changed the title Chunk report generation Report generation performance improvements Dec 23, 2023
@jesseleite jesseleite marked this pull request as ready for review December 23, 2023 07:16
@jesseleite jesseleite merged commit f8f56a1 into master Dec 23, 2023
24 checks passed
@jesseleite jesseleite deleted the chunk-report-generation-2 branch December 23, 2023 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant