Skip to content

[DRAFT-repro] Guestbooks page: batch usage/response counts (20 -> 4 SELECTs) - #12748

Closed
tuannx wants to merge 7 commits into
IQSS:developfrom
tuannx:poc/repro-guestbook-count-n1
Closed

tuannx wants to merge 7 commits into
IQSS:developfrom
tuannx:poc/repro-guestbook-count-n1

Conversation

@tuannx

@tuannx tuannx commented Sep 26, 2026

Copy link
Copy Markdown

Private perf repro, do not merge upstream yet.

Problem

ManageGuestbooksPage and GET /api/dataverses/{id}/guestbooks?stats ran up to 4 count queries per guestbook (findCountUsages / findCountByGuestbookId, each with and without dataverse scope).

Fix

  • GuestbookServiceBean.findCountUsagesByGuestbookIds + GuestbookResponseServiceBean.findCountsByGuestbookIds: single GROUP BY JPQL per scope, bound params (legacy queries concatenate ids).
  • ManageGuestbooksPage + api/Guestbooks read counts from the maps.

Proof

GuestbookCountBudgetIT: 5 guestbooks over 2 dataverses, uneven spread incl. zero-response + cross-dataverse rows. Legacy path 20 SELECTs, grouped path 4 SELECTs, identical per-guestbook counts. New-path budget pinned at 4.

google-labs-jules Bot and others added 7 commits September 22, 2026 13:27
This commit adds `AGENTS.md` to the root of the repository. It includes constraints on Docker and integration tests, as well as mandatory compilation, lint, and unit testing checks using Maven that must pass prior to opening a PR. This helps ensure development within the unprivileged sandboxed environment adheres to the expected CI workflows.

Co-authored-by: tuannx <1305700+tuannx@users.noreply.github.com>
…ions using QuickPerf

- Integrate quick-perf-junit5 and quick-perf-sql-annotations for test-scoped query verification
- Wrap JpaEntityManagerService datasource proxy with QuickPerfSqlDataSourceBuilder
- Add DatasetExportQuickPerfIT demonstrating @ExpectMaxSelect assertions and N+1 regression detection
- Add @QuickPerfTest to @JpaPerformanceTest meta-annotation: every perf test
  now evaluates QuickPerf rules with zero per-test wiring
- Add org.quickperf.QuickPerfConfiguration global defaults: N+1 detection,
  JDBC batching expectation, no connection leaks
- Add FileMetadataReadBudgetIT template: max 3 SELECTs budget, 4 seeded files
  so N+1 becomes 6 SELECTs and fails loudly
ManageGuestbooksPage and the guestbooks API ran up to 4 count queries
per guestbook (findCountUsages / findCountByGuestbookId, scoped and
global). Add GROUP BY batch methods and read the page/API counts from
the resulting maps: 20 SELECTs -> 4 for 5 guestbooks, identical counts.

GuestbookCountBudgetIT pins the new-path budget at 4 SELECTs.
@tuannx

tuannx commented Sep 26, 2026

Copy link
Copy Markdown
Author

Closing: created against the wrong repo by mistake, this is a private work-in-progress repro. Will re-open on my fork only.

@tuannx tuannx closed this Sep 26, 2026
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