forked from mtusi2026/mtusi2026lab3
Профиль при 240 req/s: доля psycopg 52.7 % -> 19.0 %, активных сэмплов 3889 -> 2026. Серия E: function в 2x1.0 CPU — потолок 552 (530–552) успешных/с, упор в CPU API; в 3x1.0 / БД 0.5 — ~420–460, упор в БД. analyze.py: линии без заливки, цвет = конфигурация, пунктир = multi, подпись — максимум серии. REPORT: раздел трека 1 и ограничения. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
68 lines
2.8 KiB
Plaintext
68 lines
2.8 KiB
Plaintext
# py-spy, 20 s at 250 Hz, ONE replica of n2-api1-pg2-pool10-message_write_path_function, k6 240 req/s (ok 239.9 req/s for the whole stand)
|
|
# label function-4830be4, commit 4830be4; samples 2026 (idle in the event loop poll: 0.0 %)
|
|
|
|
## Share of samples by library (innermost known frame)
|
|
48.9 % asyncio / uvloop (event loop)
|
|
19.0 % psycopg (PostgreSQL driver + pool)
|
|
10.6 % messenger (our code)
|
|
6.3 % uvicorn + httptools (HTTP server)
|
|
6.1 % logging (access log JSON lines)
|
|
4.7 % redis-py (Valkey client)
|
|
2.3 % json (stdlib)
|
|
2.1 % starlette (routing, middleware, responses)
|
|
0.1 % other
|
|
|
|
## Top 25 functions by SELF time (on top of the stack)
|
|
39.0 % run (asyncio/runners.py)
|
|
4.7 % send (http/httptools_impl.py)
|
|
3.8 % wait_async (psycopg/waiting.py)
|
|
3.8 % _execute_send (psycopg/_cursor_base.py)
|
|
3.5 % writelines (asyncio/streams.py)
|
|
3.0 % emit (logging/__init__.py)
|
|
2.1 % _maybe_prepare_gen (psycopg/_cursor_base.py)
|
|
1.9 % reschedule (asyncio/timeouts.py)
|
|
1.5 % _send_query_prepared (psycopg/_cursor_base.py)
|
|
1.3 % format (messenger/logging_setup.py)
|
|
1.2 % rfc3339 (messenger/timefmt.py)
|
|
1.0 % __call__ (messenger/app.py)
|
|
0.9 % iterencode (json/encoder.py)
|
|
0.9 % ensure_future (asyncio/tasks.py)
|
|
0.8 % token_hash (messenger/sessions.py)
|
|
0.8 % post_message_single_call (messenger/repo.py)
|
|
0.7 % __aexit__ (asyncio/timeouts.py)
|
|
0.7 % read_json (messenger/app.py)
|
|
0.6 % _call (messenger/sessions.py)
|
|
0.6 % create_message (messenger/app.py)
|
|
0.6 % request_fingerprint (messenger/app.py)
|
|
0.5 % connection (psycopg_pool/pool_async.py)
|
|
0.5 % fetchone (psycopg/cursor_async.py)
|
|
0.5 % unit (messenger/db.py)
|
|
0.5 % __init__ (psycopg/_cursor_base.py)
|
|
|
|
## Top 25 functions by TOTAL time (anywhere in the stack)
|
|
62.4 % _run_code (<frozen runpy>)
|
|
62.4 % main (messenger/__main__.py)
|
|
62.4 % <module> (messenger/__main__.py)
|
|
62.4 % run (asyncio/runners.py)
|
|
62.4 % run (uvicorn/server.py)
|
|
62.4 % _run_module_as_main (<frozen runpy>)
|
|
14.7 % app (starlette/routing.py)
|
|
14.5 % __call__ (messenger/app.py)
|
|
14.1 % wrapped_app (starlette/_exception_handler.py)
|
|
13.6 % __call__ (middleware/errors.py)
|
|
12.7 % __call__ (starlette/applications.py)
|
|
12.5 % create_message (messenger/app.py)
|
|
12.4 % run_asgi (http/httptools_impl.py)
|
|
12.2 % handle (starlette/routing.py)
|
|
11.2 % __call__ (starlette/routing.py)
|
|
11.2 % wait (psycopg/connection_async.py)
|
|
11.1 % wait_async (psycopg/waiting.py)
|
|
9.8 % __call__ (middleware/exceptions.py)
|
|
9.5 % execute (psycopg/cursor_async.py)
|
|
9.4 % _execute_gen (psycopg/_cursor_base.py)
|
|
8.9 % execute (psycopg/connection_async.py)
|
|
8.6 % _maybe_prepare_gen (psycopg/_cursor_base.py)
|
|
8.2 % unit (messenger/db.py)
|
|
6.4 % _log (logging/__init__.py)
|
|
5.8 % handle (logging/__init__.py)
|