首页 > 解决方案 > 使用 dev_appserver 使用 Google App Engine go111 进行本地开发很慢

问题描述

我在相当快的 Windows10 桌面上使用 dev_appserver.py 在本地运行 GAE go111 程序。我必须通过调用以经典兼容模式运行时使用 dev_appserver

appengine.Main()

我有一个安装使用的端点

http.HandleFunc("/TC/", handleTestConnection)

此端点中没有代码

func handleTestConnection(w http.ResponseWriter, r *http.Request) {
}

每次我尝试使用...访问此端点时

http://127.0.0.1:8080/TC/

...响应大约需要 2 秒。无论预热或复杂性如何,这都会发生在所有端点上。这不是第一次运行的问题,每次我调用端点时都会发生。

来自 dev_appserver 的日志如下...

DEBUG    2021-09-24 19:14:10,460 module.py:1499] Dispatching request to <Instance 9cca95d2ec7bedafddd44639c7e2cd139bfc: 0/8, total: 1> after 0.0000s pending
DEBUG    2021-09-24 19:14:12,490 <string>:134] API server executing remote_api_pb.Request: 
service_name: "logservice"
method: "Flush"
request: "\n\000"
request_id: "uumGeJVDum"
DEBUG    2021-09-24 19:14:12,492 <string>:194] API server responding with remote_api_pb.Response:
DEBUG    2021-09-24 19:14:12,492 <string>:493] Handled logservice.Flush in 0.0020
DEBUG    2021-09-24 19:14:12,493 instance.py:410] Request handled by <Instance 9cca95d2ec7bedafddd44639c7e2cd139bfc: 1/8, total: 2> in 2.0320s
INFO     2021-09-24 19:14:12,493 module.py:883] default: "GET /TC/ HTTP/1.1" 200 -
INFO     2021-09-24 19:14:12,516 module.py:883] default: "GET /favicon.ico HTTP/1.1" 200 1150

部署到 Google 应用引擎服务器后,一切正常且快速,只是本地开发速度较慢。

我尝试了许多 dev_appserver 选项,包括...

--logs_path
--dev_appserver_log_level
--log_level
--threadsafe_override
--max_module_instances
--datastore_consistency_policy
--enable_host_checking

我尝试使用本地运行

go run .

但由于这是在经典兼容模式下,这不起作用。

我试过关闭病毒检查器/防火墙。其它浏览器。使用本地主机。其他端口。3个完全不同的桌面。使用 host=0.0.0.0 然后我的本地 ip。所有导致相同的延迟。

有没有人遇到并解决了这个问题?

标签: gogoogle-app-enginedev-appserver

解决方案


推荐阅读