I have a service (called printing
) which is a Java application running in Tomcat which is used to print things via CUPS. This I believe is somewhat irrelevant but I’m putting this there for sake of completeness. The container runs Tomcat and has the CUPS client configured with the following in /etc/cups/client.conf
: ServerName cups:631
The service is linked to a cups
service which is a container running the CUPS daemon.
When I start my printing service
it takes a long time before things work. I have an REST call I can make to get the list of printers - Java queries the local CUPS client which returns the printers available on the remote CUPS server.
If the CUPS client is configured with a server that is accessed through FQDN (i.e. cups.service.example.com
) and this is accessed through external that works totally fine.
But if the CUPS client is configured as above - to access the CUPS server through a container link (aka service link in Rancher), then it takes a long time before the data is retrieved.
If I pull up the printing
service container’s console, and I do wget http://cups:631
, it takes 8 seconds for the name resolution:
root@3e5638768eca:/tmp# wget http://cups:631
--2015-10-27 16:32:31-- http://cups:631/
Resolving cups (cups)... 10.42.130.83
Connecting to cups (cups)|10.42.130.83|:631... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3697 (3.6K) [text/html]
Saving to: âindex.html.1â
index.html.1 100%[=====================>] 3.61K --.-KB/s in 0s
2015-10-27 16:32:39 (131 MB/s) - âindex.html.1â saved [3697/3697]
root@3e5638768eca:/tmp#
And that 8 seconds is more or less constant. i.e. it’s not just the first hit.
The CUPS service is in a different stack than the printing webapp service.
On the other hand, if I wget http://cups.service.example.org:631
- i.e. through my network DNS instead of through the service link, it’s instantaneous.
I just realized that since 8 seconds is a constant, it looks to me like a timeout. Could it be that first it tries to query my DNS server, times out and then tries the service discover of Rancher?
I’m unsure how to go about debugging this.