我正在創建一個 Python 專案并將其部署到 Google App Engine。
當我在另一個專案中使用已部署的鏈接時,我在 Google Cloud Logging 中收到以下錯誤訊息:
Exceeded hard memory limit of 256 MB with 667 MB after servicing 0 requests total. Consider setting a larger instance class in app.yaml.
所以,我看了這個和這個鏈接,這里是要點:
-
實體類 記憶體限制 CPU 限制 支持的縮放型別 F1(默認) 256 MB 600兆赫 自動的 F2 512 MB 1.2GHz 自動的 F4 1024 MB 2.4GHz 自動的 F4_1G 2048 MB 2.4GHz 自動的 instance_class: F2
錯誤說限制是 256 MB,但記錄的是 667 MB。F1 的記憶體限制和 F2 的記憶體限制小于 667 MB。所以我添加instance_class: F2并app.yaml更改F2為F4.
當我執行上述操作時,我在 Google Cloud Logging 中收到以下錯誤:
Exceeded hard memory limit of 1024 MB with 1358 MB after servicing 0 requests total. Consider setting a larger instance class in app.yaml.
這有點奇怪,因為記錄的記憶體是從 667 MB 到 1358 MB。
F4_1G 的記憶體限制超過 1358 MB,所以我改成instance_class: F4了instance_class: F4_1G. 但它在 Google Cloud Logging 中向我顯示以下錯誤:
Exceeded hard memory limit of 2048 MB with 2194 MB after servicing 0 requests total. Consider setting a larger instance class in app.yaml.
這很奇怪,因為記錄的記憶體從 667 MB 到 1358 MB 再到 2194 MB。
更新:
我在沒有額外實體類的情況下重現了這個問題。
請參閱下面的錯誤日志:
0: {
logMessage: "Exceeded soft memory limit of 256 MB with 924 MB after servicing 0 requests total. Consider setting a larger instance class in app.yaml."
severity: "CRITICAL"
time: "2022-10-19T06:00:39.747954Z"
}
1: {
logMessage: "This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application."
severity: "INFO"
time: "2022-10-19T06:00:39.748029Z"
}
2: {
logMessage: "While handling this request, the process that handled this request was found to be using too much memory and was terminated. This is likely to cause a new process to be used for the next request to your application. If you see this message frequently, you may have a memory leak in your application or may be using an instance with insufficient memory. Consider setting a larger instance class in app.yaml."
severity: "WARNING"
time: "2022-10-19T06:00:39.748031Z"
}
另一個發現:
當應用程式在本地終端運行時,它會消耗 1 GB - 3 GB 記憶體來運行應用程式完全加載大約需要 30 秒。同時,空閑狀態下的記憶體使用量為 700 MB - 750 MB,服務單個請求時為 750 MB - 800 MB。
誰能向我解釋為什么會這樣?如何修復此錯誤并成功使用已部署的鏈接?如果有人可以幫助我,我將不勝感激。先感謝您!
uj5u.com熱心網友回復:
首先,我將較大的檔案從本地存盤到云端。然后我成功地將代碼部署到 Google App Engine,沒有任何錯誤。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/524750.html
標籤:Google Cloud Collective Python谷歌应用引擎谷歌云平台限制谷歌应用引擎 python
