feat: limit accepted attachment work and add queue overload bench
Reject uploads with 429 at [uploads] max_unfinished_jobs, counted by the existing partial indexes in the membership block. Add the bench_queue profile, hypotheses H1-H9 and the fifth failure-stand API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
соединения API: их пулы переподключаются
|
||||
и получают «too many clients» (53300)
|
||||
clear-connections освободить слоты и дождаться подключения
|
||||
unfinished-jobs число заданий queued и processing
|
||||
backlog-api-log журнал «узкого по заданиям» API
|
||||
db-sessions pg_stat_database.sessions базы стенда:
|
||||
сколько сессий PostgreSQL приняла за всё
|
||||
время (учитывает и сессию самого вызова)
|
||||
@@ -555,6 +557,11 @@ SET_STAGING_KEY_SQL = """\
|
||||
UPDATE attachments SET staging_key = :'mode'
|
||||
WHERE id = :'title'::uuid RETURNING id;
|
||||
"""
|
||||
# незавершённые задания: то, что считает предел заданий (change
|
||||
# track1-queue-overload), без обрыва счёта
|
||||
UNFINISHED_JOBS_SQL = """\
|
||||
SELECT count(*) FROM attachment_jobs WHERE state IN ('queued', 'processing');
|
||||
"""
|
||||
SET_NEXT_ATTEMPT_SQL = """\
|
||||
UPDATE attachment_jobs
|
||||
SET next_attempt_at = clock_timestamp() + make_interval(secs => :'mode'::float8)
|
||||
@@ -1853,6 +1860,10 @@ def run(project: str, action: str, args: list[str]) -> str:
|
||||
return psql(project, DB_SESSIONS_SQL)
|
||||
if action == "attachment-ids" and not args:
|
||||
return psql(project, ATTACHMENT_IDS_SQL)
|
||||
if action == "unfinished-jobs" and not args:
|
||||
return psql(project, UNFINISHED_JOBS_SQL)
|
||||
if action == "backlog-api-log" and not args:
|
||||
return docker("logs", f"{project}-api-backlog")
|
||||
if action == "last-pending" and not args:
|
||||
return psql(project, LAST_PENDING_SQL)
|
||||
if action == "object-ids" and not args:
|
||||
|
||||
Reference in New Issue
Block a user