Why is the latency of my GAE app serving static fi

2019-06-25 23:34发布

I was checking the performance of my Go application on GAE, and I thought that the response time for a static file was quite high (183ms). Is it? Why is it? What can I do about it?

64.103.25.105 - - [07/Feb/2013:04:10:03 -0800] "GET /css/bootstrap-responsive.css
HTTP/1.1" 200 21752 - "Go http package" "example.com" ms=183 cpu_ms=0 

3条回答
神经病院院长
2楼-- · 2019-06-25 23:58

"Regular" 200 ms seems on the high side of things for static files. I serve a static version of the same "bootstrap-responsive.css" from my application and I can see two types of answer times:

  • 50-100ms (most of the time)
  • 150-500ms (sometimes)

Since I have a ping roundtrip of more or less 50ms to google app engine, it seems the file is usually served within 50ms or so.

I would guess the 150-300ms response time is related to google app engine frontend server being "cold cached". I presumed that retrieving the file from some persistent storage, involves higher latencies than if it is in the frontend server cache.

I also assume that you can hit various frontend servers and get sporadic higher latencies.

Lastly, the overall perceived latency from a browser should be closely approximated by: (tc)ping round trip + tcp/http queuing/buffering at the frontend server + file serving application time (as seen in your google app logs) + time to transfer the file.

If the frontend server is not overloaded and the file is small, the latency should be close to ping + serving time.

In my case, 50ms (ping) + 35ms (serving) = 85ms, is quite close to what I see in my browser 95ms.

Finally, If your app is serving a lot of requests, they maybe get queued, introducing a delay that is not "visible" in the application logs.

查看更多
够拽才男人
3楼-- · 2019-06-25 23:58

For a comparison I tested a site using tools.pingdom.com

Pingdom reported a Load time of 218ms

Here was the result from the logs:

2013-02-11 22:28:26.773 /stylesheets/bootstrap.min.css 200 35ms 45kb

Another test resulting in 238ms from Pingdom and 2ms in the logs.

Therefore, I would say that your 183ms seems relatively good. There are so many factors at play:

  • Your location to the server
  • Is the server that is serving the resource overloaded?

You could try serving the files using a Go instance instead of App Engine's static file server. I tested this some time ago, the results were occasionally faster, but the speeds were less consistent. Response time also increased under load, due to App Engine Instance being Limited to 10 Concurrent Requests. Not to mention you will be billed for the instance time.

Edit:

For a comparison to other Cloud / CDN providers see Cedexis's - Free Country Reports

查看更多
【Aperson】
4楼-- · 2019-06-26 00:09
登录 后发表回答