Performance: every page view reads, decodes and rewrites the whole view counter under one lock
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Refactorización
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- php
- Área
- backend, performance
Línea de trabajo
Read base.php at hypha_incrementStats() and hypha_getStats(), then trace how flushDigest() consumes the counter. Check the existing handling of data/hypha.stats and the proposed data/hypha.stats.log behavior, including period boundaries and cleanup. Done means views append short period timestamps and digest reads add and discard reported periods; pull request #678 is already open against this issue.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Part of #411.
Problem
Every page view by a visitor runs hypha_incrementStats() (base.php), which:
- takes an exclusive lock on
data/hypha.stats; - reads and decodes the whole JSON file;
- adds one;
- writes the whole file back through a temporary file and
rename().
All views of the site wait for each other on that one lock, and the file grows with every digest period. Under load on a bind mount (Docker Desktop on macOS), the rename() also briefly hides the file from a parallel fopen(), which then fails with a 500 (Cannot lock file data/hypha.stats, open failed).
The count is only read once per digest period, by flushDigest() through hypha_getStats().
Proposal
- Append one short line (the timestamp of the period) per view to
data/hypha.stats.log, withFILE_APPEND | LOCK_EX: the lock lasts microseconds, and nothing is read. hypha_getStats()adds the lines of the period to the old count inhypha.stats, and then drops the lines of periods that have been reported, so the log stays small.
- Lenguaje dominante
- JavaScript
- Estrellas
- 5
- Forks
- 9
- Merge medio
- 19 h 10 min
- PR fusionados (30 d)
- 12
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PlanBCode/hypha
-
Component: User interface Impact: Low Level: Easy Pagetype: Peer reviewed article Type: Bug Value: Visitors
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Impact: Medium Level: Easy Type: Bug Value: Users
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Impact: Low Level: Easy Pagetype: Festival Type: Bug Value: Coders
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Impact: Medium Level: Easy Pagetype: Mailinglist Type: Bug Value: Users
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día
-
Impact: Low Level: Easy Type: Bug Value: Coders
Dificultad 1/5 1-3 horas Aptitud para principiantes 85/100
PlanBCode/hypha#586 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de PlanBCode/hypha
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
factory-active task-identify-harness-labels-done task-identify-issue-type-done
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
vercel/ai#24302 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
follow-redirects updateAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
mailgun/mailgun.js#544 ·
-
beginner bug frontend
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
BistaDinesh03/critique#266 ·
Los mantenedores suelen responder en 1 día
-
New tool: ⚪️ writenodePosiblemente ocupada @github-actions la tomó hoy. Abiertosubmission triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
kausalflow/tools#251 · 1 comentario ·
Los mantenedores suelen responder en 1 día