about httpclient timeout

http://www.baeldung.com/httpclient-timeout
https://stackoverflow.com/questions/31611861/why-setconnectionrequesttimeout-doesnt-stop-my-1-min-get-request
Oracle Java parameters
https://docs.oracle.com/javase/7/docs/technotes/guides/net/properties.html

getConnectionRequestTimeout()
Returns the timeout in milliseconds used when requesting a connection from the connection manager.

getConnectTimeout()
Determines the timeout in milliseconds until a connection is established.

getSocketTimeout()
Defines the socket timeout (SO_TIMEOUT) in milliseconds, which is the timeout for waiting for data or, put differently, a maximum period inactivity between two consecutive data packets).

**sun.net.client.defaultConnectTimeout (default: -1)
sun.net.client.defaultReadTimeout (default: -1)**
These properties specify the default connect and read timeout (resp.) for the protocol handler used by java.net.URLConnection.
sun.net.client.defaultConnectTimeout specifies the timeout (in milliseconds) to establish the connection to the host. For example for http connections it is the timeout when establishing the connection to the http server. For ftp connection it is the timeout when establishing the connection to ftp servers.

sun.net.client.defaultReadTimeout specifies the timeout (in milliseconds) when reading from input stream when a connection is established to a resource.

about DNS cache

如何查看系统 DNScache 的 TTL (time to live). 如下,dig 命令的 hostname 之后就是 DNS server 返回的 TTL

 eric$ dig tianxiaohui.com

;; ANSWER SECTION:
tianxiaohui.com.    10    IN    A    118.184.11.30

如何查看浏览器 DNS TTL 时间:
chrome : chrome://net-internals/#dns
https://stackoverflow.com/questions/36917513/how-long-google-chrome-and-firefox-cache-dns-records

java 里面如何设置 DNS TTL:
https://docs.oracle.com/javase/7/docs/technotes/guides/net/properties.html
https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/java-dg-jvm-ttl.html

参考:

https://apple.stackexchange.com/questions/93949/how-long-does-the-dns-cache-last-in-mac-os-x

http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/java-dg-jvm-ttl.html

docker command cheat sheet

to check docker installed or not

$ docker -v
$ docker info

how to start docker daemon

1. Add the user to the docker group.

$ sudo usermod -aG docker $(whoami)

2. Log out and log back in to ensure docker runs with correct permissions.

3. Start docker.

$ sudo service docker start

$ docker login localhost:8080 //docker login [OPTIONS: -u, -p] [SERVER]
$ docker logout localhost:8080

$ docker commit container_id repo:tag //get container id from docker ps -l -q
$ docker commit -m 'message' -a 'admin@tianxiaohui.com' container_id repo:tag

$ docker build -t="repo/name:tag" .
$ docker build -t="repo/name" /path/to/file
$ docker build --no-cache -t="repo/name" .

$ docker images -a //list all images
$ docker images [REPOSITORY[:TAG]] //list bye repo and tag
$ docker images --no-trunc //list full image id

$ docker history image_id

$ docker rmi image_id

$ docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
$ docker run -i -t 8dbd9e392a96 /bin/bash
$ docker run --name eric -d -p 8080:80 image_id
$ docker run --restart=always image_id
$ docker run --restart=on-failure:5 image_id //non-zero exit, max retry 5

$ docker start container_id
$ docker restart container_id
$ docker stop container_id
$ docker kill container_id

$ docker attach container_id

$ docker exec -i -t 8dbd9e392a96 /bin/bash
$ docker exec -d container_id apt-get update

$ docker ps -a
$ docker ps -l n

$ docker rm [container_id or container_name]
$ docker rm -f docker ps -a -q

$ docker logs -f container_id
$ docker logs -f --tail 30 container_id

$ docker top container_id

$ docker stats container_id1 ...

$ docker inspect container_id
$ docker inspect --format '{{.NetworkSetting.IPAddress}}' container_id

$ docker port container_id

in linux, all the docker info are in folder : /var/lib/docker/