Tech
[Rust] 用 Rust(Actix + SeaORM) 写了个类 WordPress 的内容站,聊聊数据模型和踩过的坑
站点是 zendot.org ,开源项目推荐。后端 Rust ( Actix Web + SeaORM + Postgres ),前端 Next.js ,后端约 1.4 万行,跑在一台 4G 内存的小机器上。
先说结论,免得看到最后:Rust 在这个项目里给我最大的好处不是性能,是「部署就是一个二进制、没有运行时依赖」和「没有 GC 尖刺」。最大的代价是编译时间。
下面全是具体的表和数字,没有心得。
一、数据模型我是直接抄 WordPress 的
内容站要解决的问题,WordPress 二十年前就解完了。我没想到任何必须重新发明的地方,所以表结构基本照着 WP 抄:
posts ≈ wp_posts 文章本体,多两列 title_en / body_en 存英文
terms ≈ wp_terms + wp_term_taxonomy 我把 taxonomy_id 直接放在 terms 上
taxonomies ≈ wp_taxonomies ...
Read the full discussion on V2EX
This article was aggregated from V2EX. Click to join the conversation.
View on V2EX