Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

The ack blocks the thread that ran the task

Abierto
#67 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
django, python, redis

Línea de trabajo

Start at the consumer loop where fetch, execute, and acknowledge are serialized, and compare its stop-and-join handling with the prefetcher. Validate the design on a quiet machine, covering writer shutdown, ack failure ordering, durability trade-offs, and the latency-bound benchmark target.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

perf real

Each task acknowledgement sits on the critical path of the consumer. The loop fetches a task, runs it, calls acknowledge(), and starts again. Prefetching removed the fetch round trip from that path. The ack still blocks the thread that just ran the task.

Measurement (20,000 echo tasks, one process, one thread, prefetch 128, loaded machine): the ack uses 63 µs of client CPU and 97 µs blocked on the response for each task. The per-task wall time is 318 µs. The ack is thus about half of the loop. The blocked part is pure latency that the worker can use for the next task.

Proposal

Give finished results to an ack writer instead of an inline ack. The consumer puts the completed TaskResult in a queue and immediately picks up the next task. A dedicated thread serializes and acknowledges the results. Prefetch already hides the fetch round trip. This change hides the other one.

Trade-offs that need a decision

  • The durability window becomes slightly wider. A crash between execution and ack already loses the ack today. A queue between the two extends that window by one task. The lease reaper covers the task, but the result of a completed task can be lost. Today the result is written immediately.
  • Shutdown order. The writer must drain before the process exits. It needs the same stop-and-join handling as the prefetcher.
  • It hides latency but does not remove work. The CPU cost stays. On a CPU-saturated host or with several worker threads that already overlap their acks, the gain is smaller. The win applies to latency-bound configurations with one thread.
  • Ordering. Acks do not need an order today. A queue raises the question of what occurs when one ack fails and the next ack succeeds.

Why this issue exists

This is the largest remaining structural item. Prefetch already amortizes the fetch side (the acquire path decreases from a full round trip for each task to 0.008 calls for each task at prefetch 128). The ack is the only per-task round trip that remains. The other option is server-side work, which has a bound. Redis uses 20 to 54 µs for each task, depending on the load of the instance. That is about a tenth to a third of the loop, so the scripts alone cannot close the gap.

Found while validating per-task performance claims. This item needs a design decision, not a patch. The absolute microseconds come from a loaded machine. Measure again on a quiet machine before you commit to a target.

Lenguaje dominante
Python
Estrellas
19
Forks
1
Merge medio
9 h 46 min
PR fusionados (30 d)
17

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de codingjoe/threadmill

Todos los issues de codingjoe/threadmill

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.