Skip to content

⚡ Bolt: 파일 업로드 청크 크기 최적화로 성능 향상 - #424

Open
seonghobae wants to merge 2 commits into
developfrom
bolt-optimize-upload-chunk-size-1172448764261556407
Open

⚡ Bolt: 파일 업로드 청크 크기 최적화로 성능 향상#424
seonghobae wants to merge 2 commits into
developfrom
bolt-optimize-upload-chunk-size-1172448764261556407

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

What: src/newsdom_api/main.py의 비동기 파일 업로드 청크 크기를 8192 바이트에서 1MB(1024 * 1024)로 증가시켰습니다.
Why: FastAPI/Starlette에서 await file.read()와 함께 작은 청크 크기를 사용하면 막대한 스레드 풀 및 컨텍스트 스위칭 오버헤드가 발생하기 때문입니다.
Impact: 파일 업로드 루프에서 성능이 크게 향상되며, 메모리와 CPU 사용량이 감소할 것으로 기대됩니다.
Measurement: 대용량 파일(예: 10MB 이상)을 업로드할 때 소요되는 응답 시간 및 시스템 리소스 모니터링.


PR created automatically by Jules for task 1172448764261556407 started by @seonghobae

FastAPI/Starlette에서 `await file.read()` 루프의 청크 크기를 8192 바이트에서 1MB로 증가시켜 스레드 풀 및 컨텍스트 스위칭 오버헤드를 줄입니다.
Copilot AI review requested due to automatic review settings July 25, 2026 20:46
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the /parse FastAPI endpoint’s upload streaming loop to read larger chunks from UploadFile, reducing Starlette’s threadpool/context-switch overhead during async upload reads.

Changes:

  • Increased async upload read chunk size from 8KB to 1MB in src/newsdom_api/main.py.
  • Documented the performance guidance in .jules/bolt.md.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/newsdom_api/main.py Switches the upload read loop to 1MB chunks to reduce overhead while enforcing the existing max upload size limit.
.jules/bolt.md Records the “avoid small chunk sizes for async uploads” performance learning/action.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Upgraded dependencies: `pillow>=12.3.0`, `pypdf>=6.13.3`, `setuptools>=81.0.0`, `pymdown-extensions>=10.21.3`.
- Added CVEs with no fix to `.trivyignore`.
Copilot AI review requested due to automatic review settings July 25, 2026 20:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.

Comment thread src/newsdom_api/main.py
Comment on lines +253 to +254
# ⚡ Bolt: Use a larger 1MB chunk size to reduce threadpool and context-switching overhead
while chunk := await file.read(1024 * 1024):
Comment thread pyproject.toml
Comment on lines 18 to 22
"reportlab>=4.2,<6.0",
"Pillow>=11.0,<13.0",
"pillow>=12.3.0,<13.0",
"pypdf>=6.13.3,<7.0",
"setuptools>=81.0.0",
]
Comment thread pyproject.toml
Comment on lines +82 to +85
[dependency-groups]
dev = [
"pymdown-extensions>=10.21.3",
]
Comment thread .trivyignore
Comment on lines +23 to +26
# CVE-2026-61632 applies to pymdown-extensions. No fixed version is available yet,
# and it's a dev dependency for mkdocs, not part of the runtime.
# Revisit by 2026-12-31.
CVE-2026-61632
Comment thread pyproject.toml
Comment on lines 18 to 22
"reportlab>=4.2,<6.0",
"Pillow>=11.0,<13.0",
"pillow>=12.3.0,<13.0",
"pypdf>=6.13.3,<7.0",
"setuptools>=81.0.0",
]
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.

2 participants