0

I am locally running a GAE go111 program using dev_appserver.py on a reasonably fast Windows10 desktop. I have to use dev_appserver as I'm running in classic compatibility mode by calling

appengine.Main()

I have an end point that I install using

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

This endpoint has no code in it

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

Each time I try to access this endpoint using...

http://127.0.0.1:8080/TC/

...it takes ~2 seconds to respond. This happens on all endpoints regardless of warmup or complexity. This is not a first run problem, it will happen each time I call the endpoint.

The logs from dev_appserver are as follows...

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

Everything works correctly and fast once deployed to a Google app engine server, it's just local development that is slow.

I have tried numerous options of dev_appserver including...

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

I have tried running natively using

go run .

But as this is in classic compatibility mode this does not work.

I have tried turning off virus checkers / firewalls. Other browsers. Using localhost. Other ports. 3 completely different desktops. Using host=0.0.0.0 then my local ip. All result in the same delay.

Has anyone hit and solved this problem?

AshF
  • 205
  • 2
  • 6
  • I found a link to [best practices](https://cloud.google.com/blog/products/gcp/best-practices-for-app-engine-startup-time-google-cloud-performance-atlas) for app engine which explains possible reasons why it might be slower that it should. There is also a link to [this](youtube.com/playlist?list=PLIivdWyY5sqK5zce0-fd1Vam7oPY-s_8X) youtube list which also explains some common issues. If this doesn't help please specify how fast do you expect it to be, and what the classic compatibility mode is, I wasn't able to find any information regarding that in Google App Engine. – Lluís Muñoz Sep 29 '21 at 13:10
  • @LluísMuñoz many thanks for your reply. AFAICS these links talk about performance when deployed to a real AppEngine server. My problem is with local development when using dev_appserver. My deployed server is blindingly fast, the endpoint in my question replies in milliseconds and I expect that my local development server should closely match that. The appengine.Main() was documented in the migration to go 1.11 but now here is the only reference I can find. https://cloud.google.com/appengine/docs/standard/go/go-differences#package-main – AshF Oct 01 '21 at 13:47
  • Could you please share a code snippet or reproduction steps to reproduce your issue? I've tried to reproduce it by running [this](https://cloud.google.com/appengine/docs/standard/go111/quickstart#download_the_hello_world_app) code in the Cloud Console using the local development as explained [here](https://cloud.google.com/appengine/docs/standard/go111/tools/local-devserver-command). Then I called it using [Apache Benchmark](https://httpd.apache.org/docs/2.4/programs/ab.html) `ab -n 1000 -c 10 MY_URL` but everything worked fine. – Lluís Muñoz Oct 11 '21 at 08:26

0 Answers0