Repository navigation
NanoRSS v0.2.3
English
Performance
- Much lower peak memory. In a new load test that mimics a day of use (120 feeds on 40 hosts through a SOCKS5 proxy, icons, full text, the public page, a second round of updates, signing in again), the peak resident set fell from about 76 MiB to under 30 MiB:
- one runtime thread and at most two worker threads instead of one per CPU, each of which kept its own high-water mark;
- parsing a feed, extracting full text and hashing a password run one at a time, and a worker thread returns its memory after every job;
- a parsed feed frees its raw bytes before its entries are sanitised, and full-text extraction drops scripts, styles and inline SVG before building the page;
- full-text pages are read up to 4 MiB, the site page searched for an icon up to 256 KiB and an icon up to 128 KiB, instead of up to
FETCH_MAX_BODYfirst; - two read connections to the database with a smaller page cache;
- the binary is built for size (about 10 MB instead of 12.9 MB), with the same fetch and parse times in the load test;
- no idle HTTP connections are kept between fetches.
Changed
FETCH_CONCURRENCYdefaults to 4 instead of 8. Feeds are parsed one at a time, so more concurrent downloads only left more bodies waiting in memory; a full refresh takes as long as before.PASSWORD_HASH=standardnow uses Argon2id with 7 MiB and 5 passes (OWASP's lowest-memory equivalent of the former 19 MiB and 2 passes). An existing password is rehashed at the next sign-in.
Fixed
- When a feed changed, about half of its entries with images were counted as updated and rewritten although nothing in them had changed: the sanitiser wrote the two attributes it adds to an image in a random order. The order is fixed now, so the same entry always sanitises to the same HTML.
Development
- The browser tests (Chromium, Firefox, WebKit) are a required check: every test starts its own instance, so they run in parallel, one job per engine. The load test (
mise run load, three runs in CI) fails when the median peak memory is above 30 MiB or the median cold start above 300 ms; seee2e/README.md. Pull requests are built with the release profile, so these budgets measure the binary that ships.
中文
性能
- 峰值内存大幅下降。新增的负载测试模拟一天的使用(120 个订阅分布在 40 个主机、经 SOCKS5 代理抓取,网站图标、全文、公开页、第二轮更新、重新登录),峰值常驻内存从约 76 MiB 降到 30 MiB 以下:
- 一个运行时线程加最多两个工作线程,不再每个 CPU 一个线程、各自停在自己的高水位;
- 解析订阅、抽取全文和计算密码哈希一次只运行一个,工作线程每做完一个任务就归还内存;
- 解析订阅时先释放原始正文再清洗条目;全文抽取在建立网页结构前先去掉脚本、样式和内联 SVG;
- 全文网页最多读 4 MiB,找图标时网站首页最多读 256 KiB、图标最多 128 KiB,不再先读到
FETCH_MAX_BODY为止; - 数据库只读连接减为两个,页缓存更小;
- 二进制按体积优化(约 10 MB,原为 12.9 MB),负载测试中抓取与解析耗时不变;
- 两次抓取之间不再保留空闲的 HTTP 连接。
变更
FETCH_CONCURRENCY默认值由 8 改为 4。订阅一次只解析一个,更多并发下载只是让更多正文在内存里排队;全部刷新的耗时与之前相同。PASSWORD_HASH=standard改用 7 MiB、5 轮的 Argon2id(OWASP 推荐的等价配置中内存最小的一个,原为 19 MiB、2 轮)。已有密码在下次登录时重新哈希。
修复
- 订阅有更新时,其中约一半带图片的条目会被算作「已更新」并重写,实际内容并没有变:清洗程序给图片加的两个属性顺序是随机的。现在顺序固定,同一条目每次清洗得到的 HTML 都相同。
开发
- 浏览器测试(Chromium、Firefox、WebKit)成为必需检查:每个测试启动自己的实例,因此可以并行,每个引擎一个作业。负载测试(
mise run load,CI 中连跑三次)在峰值内存中位数超过 30 MiB 或冷启动中位数超过 300 ms 时失败,见e2e/README.md。PR 也用 release 配置构建,预算衡量的就是实际发布的二进制。
Image / 镜像: ghcr.io/dejavumoe/nanorss:v0.2.3 (linux/amd64, linux/arm64)
Verify / 校验: sha256sum -c SHA256SUMS