WeBlate UI preview endpoint and file watcher: Which is the primary bottleneck before optimization?
0 reputation · 18 Sept 2023, 02:56 UTC
0 reputation · 18 Sept 2023, 02:56 UTC
The goal is to identify the dominant performance bottleneck in a WeBlate deployment that hosts many projects. The UI preview endpoint currently retrieves all language files on each request, potentially driving high CPU and I/O usage. At the same time, the file‑watcher may miss rapid edits to .po files, causing the UI to display stale translations until a manual refresh. The uncertainty lies in which component contributes more to overall load under realistic traffic patterns.
To make an informed optimization decision, we need to quantify the impact of each component and understand how they interact under load.
What metrics and load‑testing scenarios best reveal the UI preview endpoint’s contribution to CPU and I/O consumption?
How can we detect and measure missed updates by the file watcher during rapid edit cycles?
Based on these measurements, which component should be prioritized for performance improvement?
35775 reputation · 18 Sept 2023, 06:13 UTC
From the behavior you described, the UI preview endpoint is the more probable source of sustained CPU and I/O load. Because it retrieves all language files on every request, its cost scales with the number of projects and languages and is paid during ordinary browsing. The file watcher is more likely a freshness defect: missed rapid .po edits cause stale UI until refresh, but they consume little sustained CPU unless each miss triggers repeated repository rescans or queued update tasks.
This is a prioritized inference from your description, not a confirmed measurement. The confirmed facts are only that the preview endpoint reads all language files per request and that the watcher can miss rapid .po edits until a manual refresh.
Average latency hides the bottleneck. Compare percentiles and per-request resource counters, and scale project/language cardinality rather than only virtual users.
| Signal | What it tells you |
|---|---|
| p50/p95/p99 latency and request rate | Whether previews degrade tail latency under realistic concurrency. |
| CPU time per preview request | Confirms parsing/rendering cost rather than background watcher cost. |
| Files opened and bytes read per request | Direct evidence of all-file retrieval. |
| Page-cache hit ratio and storage read latency | Distinguishes repeated disk I/O from cached work. |
| DB query count/time and Redis hit ratio | Shows whether previews bypass cache and add database load. |
| Celery queue depth and task duration | Reveals whether watcher misses cause update storms. |
pidstat -p $WEBLATE_PID 1
iostat -xz 1
redis-cli INFO stats | grep -E 'keyspace_hits|keyspace_misses|evicted_keys'
Use your Celery monitoring tooling to inspect active tasks and queue depth; exact commands vary by deployment.
Use canary translations: write unique msgid/msgstr markers, poll the UI or API until visible, and record edit-to-visible latency and miss rate. Repeat with in-place writes and atomic rename/replace; editors often save by rename, which can evade simple watchers.
WeBlate version and configuration change exact route names and watcher behavior, so verify on your deployment before code changes.
Are preview responses cached per user/context, and what is the current cache hit ratio? If previews are already cached with a high hit ratio, the watcher-triggered update path is more likely to be the primary bottleneck.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.