Lazy-load non-essential blueprints to improve desktop startup
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- electron, python
- Lĩnh vực
- backend, desktop-dev, performance
Hướng nghiên cứu
Start by tracing create_app() and running the three python -X importtime commands listed in the issue, then compare those results with overall startup time. Review authenticate/registry.py and the blueprint loading paths for tools, llm, and dashboard. Done means a measured, agreed scope for lazy loading that preserves the essential desktop startup flow.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
Some blueprints are imported during create_app() even though they are not required for desktop startup (SERVER_MODE=False). If we only import essential blueprints on startup and lazy load the other this would definetly result in faster load times.
After tracing the startup flow here is a breakdown of the blureprints and how we should ideally load them:
Modules that should remain eagerly loaded
| Module | Reason |
|---|---|
misc |
Provides the /misc/ping endpoint that Electron polls while waiting for the backend to start. Without it, the application never gets past the splash screen. |
browser |
Hasindex(), the first page Electron loads after startup. Deferring it only shifts the wait from the splash screen to a blank window. preferences also depends on it. |
Core authenticate |
Required for session and login handling, even in desktop mode. |
Good lazy-loading candidates
| Module | Load when | Reason | Approx. size |
|---|---|---|---|
authenticate (kerberos, ldap, mfa, oauth2, webserver) |
Never in desktop mode | Gate imports in authenticate/registry.py behind config.SERVER_MODE. Desktop runs with SERVER_MODE=False and doesn't use these providers. |
~14 files |
tools |
First tool opens | Query Tool, Debugger, Backup/Restore, ERD, Import/Export, etc. aren't needed during startup. | ~155 files |
llm |
AI assistant opened | Depends on pgadmin.tools.user_management, so it would likely move together with tools. |
~32 files |
dashboard |
First server/database opened | The dashboard isn't shown until after a connection is opened. | ~7 files |
Note: Considering how often tools are used, we can keep the tools blueprint in the early-loading category for a few select tools.
Not worth lazy-loading
These modules are tiny (1–4 files each):
preferencessettingsabouthelpredirects
Estimated impact
Potentially removes eager imports for roughly:
toolsllm- External authentication backends
≈ 190 of ~915 Python files
File count is only a rough proxy and not an estimate of startup improvement.
Validation
Profile import costs:
python -X importtime -c "from pgadmin.tools import blueprint"
python -X importtime -c "from pgadmin.llm import blueprint"
python -X importtime -c "from pgadmin.authenticate.registry import AuthSourceRegistry"
Then compare against overall create_app() startup time.
Proposal
- Gate external auth provider imports behind
config.SERVER_MODE. - Lazy-load
toolson first use. - Lazy-load
llmtogether withtools. - Optionally lazy-load
dashboardif it can be done cleanly.
I would be happy to start from the authenticate change since it's small and self-contained.
This is not a concrete implementation proposal, but rather a summary of observations from tracing the desktop startup flow and a few areas that might be worth exploring. I have not profiled import times yet but plan to do so shortly, so these suggestions are based on the current startup path and module dependencies rather than measured performance. However, I will shortly run the performance tests and provide details as a follow-up to this issue.
I would also appreciate some guidance on whether these are the right areas to target, or if there is a better approach I'm overlooking.
Thanks
- Ngôn ngữ chính
- Python
- Star
- 3.9k
- Fork
- 918
- Merge trung bình
- 2 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 35
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của pgadmin-org/pgadmin4
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
pgadmin-org/pgadmin4#10673 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Import/Export Data fails for a file name containing a backslash, and creates a stray file named EĐang mởBug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
pgadmin-org/pgadmin4#10672 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
pgadmin-org/pgadmin4#10426 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Drag-n-drop file to sql editor tool don't clear previous content before adding the new content in windowsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởFeature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
pgadmin-org/pgadmin4#10272 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Housekeeping
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
pgadmin-org/pgadmin4#10157 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của pgadmin-org/pgadmin4
Issue tương tự
-
Edit: TVS Encarnacion [PY]Đang mởchannels:edit check:passed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] The blue-green mitigation strategy lists catalog names and views before the source tablesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
aws-samples/sample-aws-genai-db-modernizer#2097 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
ietf-tools/datatracker#12027 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Python SDK overwrites OVPack backups with HTTP 200 JSON errorsCó thể đã có người làm @stefanielizeth73-art đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
volcengine/OpenViking#7347 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
deepset-ai/haystack-core-integrations#4228 ·
Maintainer thường phản hồi trong vòng 1 ngày