> For the complete documentation index, see [llms.txt](https://ayakaleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ayakaleaf-pro.ayaka.space/on-premises/zh-cn/ru-men/requirements/hardware-requirements.md).

# 硬件要求

## 硬件要求

为运行 Overleaf 配置硬件时，主要需要考虑的因素是会有多少并发用户正在进行编译。

例如，如果您拥有 100 名总用户的许可证，但预计同时只有约 5 人在工作，那么最低配置安装即可满足需求。如果预计会有更高比例的用户同时工作（并进行编译），则应考虑配置规格更高的服务器。

### 最低配置安装

对于约 5 名并发用户的基本操作，最低基础要求为 2 个核心和 3GB 内存。对于并发使用较少的较大群体，或者在高负载使用期间可以接受较长编译时间的情况，此最低要求同样足够。

{% hint style="danger" %}
如果您正考虑为小型实例使用基于 NFS（网络文件系统）的文件系统，请查看 [故障排除](/on-premises/zh-cn/zhi-chi/troubleshooting.md) 章节。
{% endhint %}

### 扩展

经验法则是，为了提供高且稳定的服务水平，每增加 5–10 名并发用户，就应在最低配置安装的基础上增加 1 个 CPU 核心和 1GB 内存。

这只能作为参考，因为典型文档的大小（较大的文档会消耗更多编译资源）、用户编译的频率，以及在高负载使用期间对较长编译时间的容忍度等因素，都会影响所需的资源配置水平。

许多客户希望在整个组织范围内或大型团队中部署 Server Pro。在这些情况下，我们很难就具体设置要求提供建议，因为使用场景和可用的底层硬件可能差异很大。

| 示例 1                                                                                                                                | 示例 2                                                                                                       |
| ----------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| 如果您为共 300 名用户运行 Server Pro 安装，并且经常预计其中有 30–60 名用户同时编译文档，那么 8GB 内存和 7 个核心（5 个核心 + 5GB，加上基础配置的 2 个核心和 3GB）应能提供足够的资源，以便您的用户持续获得高水平的服务。 | 举例说明大型部署的硬件要求：一个面向 1,000 名总用户的 Server Pro 安装已成功部署在单台服务器上，该服务器配备两颗 4 核处理器和 32GB 系统内存。在过去一年的使用中，这已足以满足团队的需求。 |

超过单台大型服务器限制的客户可以查看 [水平扩展](/on-premises/zh-cn/wei-hu/horizontal-scaling.md) 适用于 Server Pro。

### 存储

我们建议不要在大型部署中使用网络文件系统（NFS）/Amazon EFS/Amazon EBS 来存储项目和历史记录，并且明确 **不支持此做法** 用于水平扩展。

这些文件系统的行为无法提供 Server Pro 在大规模运行时所需的性能和可靠性。当文件系统无法跟上负载时，应用程序会因过多阻塞式 I/O 操作而停滞。这些停滞可能导致基于 Redis 的锁超时，进而可能造成项目数据损坏。

我们建议改用 [兼容 S3 的对象存储](/on-premises/zh-cn/ru-men/what-is-the-overleaf-toolkit.md) 。而 S3 性能缓慢只会影响文件上传/下载，仅会增加到您的 S3 提供商的打开连接数，不会影响应用程序其余部分的行为。此外，Server Pro 可以为 S3 请求指定合理的超时时间，而在应用程序层面，这对于文件系统/I/O 操作是不可能的。

{% hint style="info" %}
供参考，GitLab 对其自托管产品也采取了类似立场，即 [不支持 NFS/Amazon EFS](https://docs.gitlab.com/ee/administration/nfs.html) 。
{% endhint %}

### 大型部署的 Nginx 专用配置

默认情况下，Overleaf Server 实例将连接数限制为 768。这包括持久 WebSocket 连接、顶级 HTML 导航和 AJAX 请求。一旦达到该限制，编辑器可能无法连接，编辑器页面可能无法完全加载，编译请求也可能失败。Nginx 将返回状态码 500 的响应，并记录 `连接到上游服务器时 worker_connections 不足` 到 `var/log/nginx/error`。log，位于 `sharelatex` 容器内。

该 [`worker_connections`](https://nginx.org/en/docs/ngx_core_module.html#worker_connections) 设置限制 nginx 每个工作进程接受的并发连接数。工作进程数量由 [`worker_processes`](https://nginx.org/en/docs/ngx_core_module.html#worker_processes) 设置控制，在我们的 nginx 配置中默认设为 4。

与系统的其他部分相比，Nginx 的工作量不大，因此这些限制作为安全措施，可防止过多连接压垮系统。与其让每个连接都变慢，不如及早丢弃一些超出的连接。

Overleaf Server 实例提供了用于调整这些 nginx 设置的环境变量：

* `NGINX_WORKER_PROCESSES` 用于 [`worker_processes`](https://nginx.org/en/docs/ngx_core_module.html#worker_processes) （默认值 `4`)
* `NGINX_WORKER_CONNECTIONS` 用于 [`worker_connections`](https://nginx.org/en/docs/ngx_core_module.html#worker_connections) （默认值 `768`)
* `NGINX_KEEPALIVE_TIMEOUT` 用于 [`keepalive_timeout`](https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_timeout) （默认值 `65`)

  <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>当在该 <code>sharelatex</code> 容器前运行另一个代理（例如用于 TLS 终止）时， <code>NGINX_KEEPALIVE_TIMEOUT</code> Overleaf Server 实例中的该值需要大于前一个代理。例如，在 Docker 主机上运行另一个 nginx 进程 <strong>nginx-host</strong>时，以下是两个示例：</p></div>
* 默认值 `NGINX_KEEPALIVE_TIMEOUT`，使用 [`keepalive_timeout 60s`](https://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive_timeout) （上游中的默认值）在 **nginx-host**
* 自定义值 `NGINX_KEEPALIVE_TIMEOUT=100s`，使用 [`keepalive_timeout 90s`](https://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive_timeout) （上游中的自定义值）在 **nginx-host**

### CPU 速度

LaTeX 是单线程程序，这意味着它一次只能使用一个 CPU 核心。CPU 也是编译文档时的主要限制因素。因此，CPU 的单核性能越快，您编译文档的速度就越快。只有当您尝试编译的文档数量多于空闲 CPU 核心数量时，更多核心才会有所帮助。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ayakaleaf-pro.ayaka.space/on-premises/zh-cn/ru-men/requirements/hardware-requirements.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
