3

Based on 100 requests.
Region: southamerica-east1

When executing a GET at xxx.appspot.com/api/v1/ping the average response time is +/- 50 ms.

Example: Load time: 83 ms

When activating dispach.yaml (gcloud app deploy dispatch.yaml) and executing the request with the new URL, xxx.mydomain.com/api/v1/ping, the average response time is 750 ms.

Example Load time: 589 ms

dispatch.yaml

dispatch:
  - url: "*/api/*"
  service: my-service

I'm using spring boot on the server. follow app.yaml

service: my-service
runtime: java
env: flex
threadsafe: true

runtime_config:  # Optional
  jdk: openjdk8


handlers:
- url: /api/*
  script: this field is required, but ignored

manual_scaling:
  instances: 1

resources:
  cpu: 2
  memory_gb: 2.3

How do I improve the response time?

Am I using the dispatch correctly to associate my requests with my domain?

curl -w "@curl-format.txt" -o ./ -s http://my.domnai.com/

        time_namelookup:  0,253
           time_connect:  0,328
        time_appconnect:  0,000
       time_pretransfer:  0,328
          time_redirect:  0,000
     time_starttransfer:  1,713
                        ----------
             time_total:  1,714

curl -w "@curl-format.txt" -o ./ -s http://my-app.appspot.com/

        time_namelookup:  0,253
           time_connect:  0,277
        time_appconnect:  0,000
       time_pretransfer:  0,277
          time_redirect:  0,000
     time_starttransfer:  0,554
                        ----------
             time_total:  0,554
Tainha
  • 106
  • 5
  • Can you specify how you are calculating load time? There might be possibility that your load time = DNS lookup time + network latency. Network latency would be same for both the cases but DNS lookup time may vary. – Prasad Kothavale Apr 02 '18 at 18:59
  • Hi, i using Jmeter for execute many request to my server. You suggest a tools for get dns resolve times ? As I make many requests in a short time, do you still believe it is DNS? – Tainha Apr 03 '18 at 19:16
  • Not sure how it is handled in JMeter but you can try `curl` command to get response time breakdown. Here it is given how to do - https://blog.josephscott.org/2011/10/14/timing-details-with-curl/ – Prasad Kothavale Apr 03 '18 at 20:16
  • I'll add in the post more details of the curl – Tainha Apr 09 '18 at 12:53
  • Using the custom domain is rather orthogonal to using a dispatch file. Do you see the same delay if you're using the dispatch file and the `appspot.com` domain? – Dan Cornilescu Apr 09 '18 at 13:45

1 Answers1

1

Using a custom domain is rather orthogonal to using a dispatch file.

When App Engine receives a request it first needs to determine which application is the request destined to. By default it does that using exclusively the requests's domain name, be it appspot.com or a custom domain. From Requests and domains:

App Engine determines that an incoming request is intended for your app by using the domain name of the request.

While making this decision it also determines a particular version of a service in the application to send the request to, based on the rules described in Routing via URL.

Requests using a custom domain might require some additional processing compared to using appspot.com (I'm unsure about this), which could explain some increase in the response time. This can be confirmed by measurements. But if so, I don't think there's anything you can do about it.

Note that a dispatch file is not required to make the above-mentioned routing decisions. Even if you use a custom domain. In fact there is no reference to the dispatch file anywhere in Adding a custom domain for your application. But if want to alter these decisions then you need to use a dispatch file.

The dispatch file allows to also take the request path into account (in addition to the request domain name) when making the routing decisions.

Using a dispatch file will increase the response time as the request domain and path must be sequentially compared against each and every rule in the dispatch file, until a match is found. If no match is found the request will be sent to the version of the app's default service configured to receive traffic. You can slightly reduce the processing time for particular services by placing their rules earlier in the dispatch file, but that's about all you can do.

Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97