Performance: every page view reads, decodes and rewrites the whole view counter under one lock
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- php
- 領域
- backend, performance
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- JavaScript
- スター
- 5
- フォーク
- 9
- 平均マージ
- 19時間 10分
- マージ済み PR(30日)
- 12
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PlanBCode/hypha のほかの issue
-
Component: User interface Impact: Low Level: Easy Pagetype: Peer reviewed article Type: Bug Value: Visitors
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
Impact: Medium Level: Easy Type: Bug Value: Users
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
Impact: Low Level: Easy Pagetype: Festival Type: Bug Value: Coders
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
Impact: Medium Level: Easy Pagetype: Mailinglist Type: Bug Value: Users
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信
-
Impact: Low Level: Easy Type: Bug Value: Coders
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
PlanBCode/hypha#586 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
PlanBCode/hypha の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
pigeon189/zcode-fox-widget#17 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
Let TypeScript accept an initial object in ReactiveDict対応中かも @yograj-vijay-yadav が今日担当しました。 オープンbug good first issue help wanted workshop
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
meteor/meteor#14919 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
akitaonrails/FrankMD#268 ·
メンテナーはふだん 1 日以内に返信
-
good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信