8000 perf: Apply backpressure on link counts by ankush · Pull Request #32712 · frappe/frappe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

perf: Apply backpressure on link counts #32712

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

Merged
merged 1 commit into from
May 29, 2025

Conversation

ankush
Copy link
Member
@ankush ankush commented May 29, 2025

Brought to you by https://github.com/frappe/erpc

Context: This is a QoL feature to highlight the most used items. But in high throughput environments where a lot of new documents are being created, this becomes a major bottleneck.

Fix: Limit the size of counts that can be buffered before they're flushed.

Statistically, this will still work just as well as it did before... maybe not that well on large datasets because of the small sample size.

image

Before: 67K transactions/hour @ ~7s p99 latency

image

After: 98K transactions/hour @ ~2s p99 latency

image

Note: these runs have few more optimizations, but this PR is dominant one.

Context: This is QoL feature to highlight most used items. But in high
throughput environments where a lot of new documents are being created
this becomes a bottleneck.

Fix: Limit the size of counts that can be buffered before they're flushed.

Statistically this will still work just as well as it did before.
@ankush ankush added backport version-14-hotfix backport to version 14 backport version-15-hotfix Backport the PR to v15 labels May 29, 2025
@ankush
Copy link
Member Author
ankush commented May 29, 2025

Merging for now, will port later w/ other things

@ankush ankush added defer backport Backports for some PR are deferred for a week or two to test them properly before releasing and removed backport version-14-hotfix backport to version 14 backport version-15-hotfix Backport the PR to v15 labels May 29, 2025
@ankush ankush merged commit 4d8ebcc into frappe:develop May 29, 2025
22 of 23 checks passed
@ankush ankush deleted the backpressure_link_acount branch May 29, 2025 06:25
@ankush ankush added backport version-14-hotfix backport to version 14 backport version-15-hotfix Backport the PR to v15 and removed defer backport Backports for some PR are deferred for a week or two to test them properly before releasing labels May 29, 2025
mergify bot pushed a commit that referenced this pull request May 29, 2025
Context: This is QoL feature to highlight most used items. But in high
throughput environments where a lot of new documents are being created
this becomes a bottleneck.

Fix: Limit the size of counts that can be buffered before they're flushed.

Statistically this will still work just as well as it did before.

(cherry picked from commit 4d8ebcc)

# Conflicts:
#	frappe/model/utils/link_count.py
mergify bot pushed a commit that referenced this pull request May 29, 2025
Context: This is QoL feature to highlight most used items. But in high
throughput environments where a lot of new documents are being created
this becomes a bottleneck.

Fix: Limit the size of counts that can be buffered before they're flushed.

Statistically this will still work just as well as it did before.

(cherry picked from commit 4d8ebcc)
ankush added a commit that referenced this pull request May 29, 2025
Context: This is QoL feature to highlight most used items. But in high
throughput environments where a lot of new documents are being created
this becomes a bottleneck.

Fix: Limit the size of counts that can be buffered before they're flushed.

Statistically this will still work just as well as it did before.

(cherry picked from commit 4d8ebcc)

Co-authored-by: Ankush Menat <ankush@frappe.io>
frappe-pr-bot pushed a commit that referenced this pull request Jun 3, 2025
## [15.69.3](v15.69.2...v15.69.3) (2025-06-03)

### Bug Fixes

* allow `Float` fields to be empty ([d4ebe1d](d4ebe1d))
* default fields filter not working in web form ([6bd1c83](6bd1c83))
* Implement backpressure for background jobs (backport [#31489](#31489)) ([#32745](#32745)) ([4cee4ba](4cee4ba))
* permission error when permission docname is none ([776d810](776d810))
* Sample link counts and flush frequently ([#32713](#32713)) ([#32725](#32725)) ([56b03c8](56b03c8))

### Performance Improvements

* Apply backpressure on link counts ([#32712](#32712)) ([#32722](#32722)) ([d5ab9eb](d5ab9eb))
ankush added a commit that referenced this pull request Jun 4, 2025
* perf: Apply backpressure on link counts (#32712)

Context: This is QoL feature to highlight most used items. But in high
throughput environments where a lot of new documents are being created
this becomes a bottleneck.

Fix: Limit the size of counts that can be buffered before they're flushed.

Statistically this will still work just as well as it did before.

(cherry picked from commit 4d8ebcc)

# Conflicts:
#	frappe/model/utils/link_count.py

* chore: conflicts

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
PratikBGhuge pushed a commit to PratikBGhuge/frappeApp that referenced this pull request Jun 10, 2025
## [15.69.3](frappe/frappe@v15.69.2...v15.69.3) (2025-06-03)

### Bug Fixes

* allow `Float` fields to be empty ([d4ebe1d](frappe/frappe@d4ebe1d))
* default fields filter not working in web form ([6bd1c83](frappe/frappe@6bd1c83))
* Implement backpressure for background jobs (backport [#31489](frappe/frappe#31489)) ([#32745](frappe/frappe#32745)) ([4cee4ba](frappe/frappe@4cee4ba))
* permission error when permission docname is none ([776d810](frappe/frappe@776d810))
* Sample link counts and flush frequently ([#32713](frappe/frappe#32713)) ([#32725](frappe/frappe#32725)) ([56b03c8](frappe/frappe@56b03c8))

### Performance Improvements

* Apply backpressure on link counts ([#32712](frappe/frappe#32712)) ([#32722](frappe/frappe#32722)) ([d5ab9eb](frappe/frappe@d5ab9eb))
frappe-pr-bot pushed a commit that referenced this pull request Jun 10, 2025
## [14.96.8](v14.96.7...v14.96.8) (2025-06-10)

### Bug Fixes

* conflicts ([296acc0](296acc0))
* ensure proper type conversion for disable_prepared_report update ([#32329](#32329)) ([28c17db](28c17db))
* throw permission error ([#32860](#32860)) ([e848182](e848182))

### Performance Improvements

* Apply backpressure on link counts (backport [#32712](#32712)) ([#32721](#32721)) ([1be11bd](1be11bd))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport version-14-hotfix backport to version 14 backport version-15-hotfix Backport the PR to v15
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0