> For the complete documentation index, see [llms.txt](https://overleaf-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://overleaf-pro.ayaka.space/on-premises/zh-tw/ru-men-zhi-nan/requirements/hardware-requirements.md).

# 硬體需求

## 硬體需求

佈建用於執行 Overleaf 的硬體時，主要考量因素是會有多少並行使用者執行編譯。

例如，如果您擁有 100 名使用者的授權，但預期同時只有約 5 人在工作，最低安裝規格便已足夠。如果您預期會有較高比例的使用者同時工作（及編譯），則應考慮佈建規格更高的伺服器。

### 最低安裝規格

對於約 5 名並行使用者的基本操作，最低基本需求為 2 個核心及 3GB 記憶體。對於並行使用較少的較大群組，或在大量使用期間可接受較長編譯時間的情況下，此最低需求也已足夠。

{% hint style="danger" %}
如果您正在考慮為小型執行個體使用以 NFS（網路檔案系統）為基礎的檔案系統，請參閱 [疑難排解](/on-premises/zh-tw/zhi-yuan/troubleshooting.md) 章節。
{% endhint %}

### 擴充

根據經驗法則，為提供高且穩定的服務水準，每增加 5–10 名並行使用者，應在最低安裝規格上增加 1 個 CPU 核心和 1GB 記憶體。

這僅應作為參考，因為常見文件的大小（較大的文件會使用更多編譯資源）、使用者編譯的頻率，以及在大量使用期間對較長編譯時間的容忍度等因素，都會影響所需的佈建程度。

許多客戶希望在整個組織或大型團隊中部署 Server Pro。在這些情況下，我們難以針對特定設定需求提供建議，因為使用案例和可用的底層硬體可能差異很大。

| 範例 1                                                                                                                                 | 範例 2                                                                                                                  |
| ------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------- |
| 如果您執行的 Server Pro 安裝供總計 300 名使用者使用，並且經常預期其中有 30–60 名使用者同時編譯文件，8GB 記憶體和 7 個核心（5 個核心 + 5GB，加上基本的 2 個核心與 3GB）應能提供足夠資源，讓您的使用者持續獲得高水準的服務。 | 舉例來說，針對較大型部署的硬體需求，已有一套供總計 1,000 名使用者使用的 Server Pro 安裝成功設定於單一伺服器上，該伺服器配備兩個 4 核心處理器及 32GB 系統記憶體。在過去一年的使用期間，這已足以滿足團隊的需求。 |

超出單一大型伺服器限制的客戶可以參閱 [水平擴充](/on-premises/zh-tw/wei-hu/horizontal-scaling.md) 適用於 Server Pro。

### 儲存空間

我們建議不要在大型設定中使用網路檔案系統（NFS）/Amazon EFS/Amazon EBS 儲存專案／歷程記錄，並且明確 **不支援此作法** 用於水平擴充。

這些檔案系統的行為無法在 Server Pro 大規模執行時提供所需的效能和可靠性。當檔案系統無法跟上負載時，應用程式會因過多的阻塞式 IO 操作而停滯。這些停滯可能導致以 Redis 為基礎的鎖定逾時，進而造成專案資料損毀。

我們建議改用 [相容 S3 的物件儲存空間](/on-premises/zh-tw/ru-men-zhi-nan/what-is-the-overleaf-toolkit.md) 。緩慢的 S3 效能只會影響檔案上傳／下載，僅會增加與您的 S3 供應商建立的開放連線數量，不會影響應用程式其餘部分的行為。此外，Server Pro 可以為 S3 請求指定合理的逾時時間，這在應用程式層級無法套用於檔案系統／IO 操作。

{% 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`位於 `sharelatex` 容器內的 .log 檔案。

此 [`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> 容器前方執行另一個 Proxy（例如用於 TLS 終止）時， <code>NGINX_KEEPALIVE_TIMEOUT</code> Overleaf Server 執行個體中的設定值必須大於前一個 Proxy。例如，若 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://overleaf-pro.ayaka.space/on-premises/zh-tw/ru-men-zhi-nan/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.
