You have probably found these docs because you are experiencing latency with container to container networking.
There are 4 places where the slowness can be coming from:
- the source app
- dns resolution
- networking
- the destination app
Here are some debugging tools you can try to dig deeper and find the source of the issue.
If you need more help than this doc, or need help analyzing the results, feel free to reach out to us in the #container-networking channel on Cloud Foundry Slack.
Goal: determine if the backend app's databse queries are the cause of the problem
- Are all of the requests identical?
- Do the requests result in touching a database?
- Do the backend app's database query times show increased times at the time of the latency spike?
Goal: this should either identify DNS as the issue or eliminate it as the problem
cf sshonto your source appdigthe internal route- Observe the time the
digtakes
For example:
$ dig backend.apps.internal
; <<>> DiG 9.11.3-1ubuntu1.3-Ubuntu <<>> backend.apps.internal
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17122
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;backend.apps.internal. IN A
;; ANSWER SECTION:
backend.apps.internal. 0 IN A 10.255.96.4
;; Query time: 2 msec
;; SERVER: 169.254.0.2#53(169.254.0.2)
;; WHEN: Fri Jan 25 01:58:30 UTC 2019
;; MSG SIZE rcvd: 76
There are 2 important pieces of information here.
ANSWER 1orANSWER 0:1means that it was able to resolve the route,0means it was unable to resolve the route.Query time: 2 msec: This means that the dns resolution took 2 milliseconds.
Goal: this should either identify your apps as the issue or eliminate them as the problem
Push our simple go app and see if there is latency when you curl it. Go app code here.
- push the app
cf push proxy
- create an internal route
cf map-route proxy apps.internal --hostname proxy
- create policy from your frontend app to proxy
cf add-network-policy FRONTEND-APP --destination-app proxy --protocol tcp --port 8080
- get onto the frontend app
cf ssh FRONTEND-APP
- time how long curling the same go app takes
time curl proxy.apps.internal
If there is no latency seen the problem likely originates in either your frontend or backend app. If there is latency seen the problem likely originates with the DNS or the networking
Goal: another way to eliminte DNS as the source of the problem
This is not meant a solution to the problem. This should only be used to determine if the slowness is still present when DNS is taken out of the equation.
- Look up the overlay IP of the destination app.
cf sshonto your source app- Curl the destination app by it's overylay IP:
curl DESTINATION-OVERLAY-IP:DESTINATION-APP-PORT. - Try this for apps that are on the same cell and apps that are on different cells.