# 加速独立运行 Discourse 的最佳配置

**URL:** <https://meta.discourse.org/t/best-configurations-for-speeding-up-standalone-discourse/162456>\
**Category:** Self-hosting\
**Tags:** server-resources\
**Created:** [2020 年8 月 30 日 07:39 UTC](https://meta.discourse.org/t/best-configurations-for-speeding-up-standalone-discourse/162456 "2020-08-30T07:39:37Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)\
**Post date:** [2020 年8 月 31 日 16:24 UTC](https://meta.discourse.org/t/best-configurations-for-speeding-up-standalone-discourse/162456/11 "2020-08-31T16:24:07Z")

</div>

> [@marianord](#):
>
> 你减少了到达服务器的请求数量，从而降低了负载

静态文件的请求对整体服务器负载的影响不大。动态内容的请求才是负担较重的部分。

> [@marianord](#):
>
> 为每个用户仅提供 10 个 JSON 请求，比提供 100 个请求要容易得多。

通常，`json` 请求并非可由 CDN 缓存的静态资源，而是动态生成的内容。你为何在 CDN 的语境下讨论 JSON 文件？

> [@marianord](#):
>
> 通过从 Discourse 服务器中移除所有静态请求（即已缓存的请求），来减轻服务器的较重负载。

静态请求 ≠ 较重负载。

很抱歉，这实在是不好的建议。

以下是一个运行 Discourse 但未使用 CDN 或 S3 的 6 核 CPU 机器的示例（因此 CPU 总容量为 600%）。

 ![image](https://global.discourse-cdn.com/meta/original/3X/5/5/55bdc96002d27f13caf5ec0704ab25b968ec15ca.png)

你可以看到，nginx 仅占 6.7%（即 **总容量的 1/100** ）。其中只有一部分用于静态资源。

即使我们将静态资源卸载到 S3 和/或 CDN，整体服务器负载的降低幅度也不到 1%。

---

_[View the full topic](https://meta.discourse.org/t/best-configurations-for-speeding-up-standalone-discourse/162456)._
