Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

perf: Optimize metadata records processing inSqlStorageClient#1551

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Mantisus wants to merge13 commits intoapify:master
base:master
Choose a base branch
Loading
fromMantisus:sql-metadata-buffer

Conversation

@Mantisus
Copy link
Collaborator

@MantisusMantisus commentedNov 11, 2025
edited
Loading

Description

  • This PR adds newbuffer tables to improve handling ofmetadata records. The key change is that updates tometadata are now accumulated inbuffer and applied whenget_metadata is called. With the old behavior,metadata records were updated instantly within a transaction. This led to waiting for locks to be released in high-concurrency situations.

Issues

@MantisusMantisus self-assigned thisNov 11, 2025
Copy link
Collaborator

@vdusekvdusek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Please PR type without an exclamation mark

@MantisusMantisus changed the titleperf!: Optimize metadata records processing in 'SqlStorageClient`perf: Optimize metadata records processing in 'SqlStorageClient`Nov 11, 2025
@MantisusMantisus marked this pull request as ready for reviewNovember 17, 2025 14:03
@janbuchar
Copy link
Collaborator

Interesting! I'd imagine that transactions consisting of e.g., an insertion to the dataset_items table and an update to dataset metadata wouldn't lock the metadata table for that long - you can commit right after the update to metadata.

Also, the buffering approach is faster because the buffer table gets a row for each increment and those get compacted later on, correct?

@Mantisus
Copy link
CollaboratorAuthor

update to dataset metadata wouldn't lock the metadata table for that long

They will create many short-lived locks. And with a large number of clients with high concurrency inserting new records, this effect will accumulate.
This is exactly what@ericvg97 pointed out -#1533 (comment)

Although, of course, the strongest impact on RequestQueue

Yes, insert operations into the buffer table are quite fast. And then we can simply apply the result of the aggregations to update the metadata record.

@MantisusMantisus changed the titleperf: Optimize metadata records processing in 'SqlStorageClient`perf: Optimize metadata records processing inSqlStorageClientNov 18, 2025
@janbuchar
Copy link
Collaborator

update to dataset metadata wouldn't lock the metadata table for that long

They will create many short-lived locks. And with a large number of clients with high concurrency inserting new records, this effect will accumulate. This is exactly what@ericvg97 pointed out -#1533 (comment)

Although, of course, the strongest impact on RequestQueue

I see, thanks. And is there any chance that the lock is held for too long because of how we work with sqlalchemy? In other words, would it be better if we just executed sql such asinsert ...; update ...; commit in one go? If yes, it might be worth trying before adding three new tables to the whole thing.

@Mantisus
Copy link
CollaboratorAuthor

it might be worth trying before adding three new tables to the whole thing.

I will test this approach.

@MantisusMantisus marked this pull request as draftNovember 26, 2025 16:36
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@janbucharjanbucharAwaiting requested review from janbuchar

@vdusekvdusekAwaiting requested review from vdusek

Assignees

@MantisusMantisus

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Updating request queue metada performs full table scan in SQL storage

3 participants

@Mantisus@janbuchar@vdusek

[8]ページ先頭

©2009-2025 Movatter.jp