Network
- 网络基本功系列:细说网络那些事儿
- https://github.com/alex/what-happens-when#dns-lookup 浏览器如何访问google
- Proxy Digest Authentication?
- Why TChannel?
- Why not HTTP? HTTP connections are uni-directional, can only be used for one concurrent request, and are built for delivering web pages with cache hints. HTTP tightly couples encoding and transport concerns (the path implies both the procedure name and sometimes even parts of the request body), having a single, header namespace with variable widths. It is not ideal for RPC, but it's fantastic for web pages.
- HTTP2:
- Solve head of line blocking by HTTP pipelining
- HTTP is poll mode, not bidirectional: http协议和websocket协议的区别
- Multiplexing over single TCP connection
- HTTP2 vs WebSocket
- WebSocket is bidirectional; HTTP2 is client/server + server push
- TChannel: RPC, multiplexing, bi-directional message passing, fast forwarding, work shedding with deadlines, cancellation, speculative execution, and communicates more clearly about when and when not to retry.
- Improve Web Speed: client -> DNS resolver -> DNS -> DNS resolver -> client --req--> Web server
- Speed = DNS latency + Request latency. Which DNS has lowest latency? Can't measure directly because of DNS resolver delegates the name resolution. Solution: create a special hostname to resolve (avoid cache), latency = server access time - special hostname resolve time
DNS resolvers
DNS客户端设置使用的DNS服务器(8.8.4.4)一般都是递归服务器,它负责全权处理客户端的DNS查询请求,直到返回最终结果。而DNS服务器之间一般采用迭代查询方式
- clear DNS cache
sudo killall -HUP mDNSResponder
- check DNS client: sudo lsof -i -P | grep LISTEN
- http://whoismydns.com/Index.html
- dig @127.0.0.1 -p 53 google.com +tcp +trace
TCP
- Connection Reset: the peer rejects it with an RST to let you know it isn't listening.
- send() returns only means transmitted through interface
- 网络基本功系列:细说网络那些事儿
- https://github.com/alex/what-happens-when#dns-lookup 浏览器如何访问google
- Proxy Digest Authentication?
- Why TChannel?
- Why not HTTP? HTTP connections are uni-directional, can only be used for one concurrent request, and are built for delivering web pages with cache hints. HTTP tightly couples encoding and transport concerns (the path implies both the procedure name and sometimes even parts of the request body), having a single, header namespace with variable widths. It is not ideal for RPC, but it's fantastic for web pages.
- HTTP2:
- Solve head of line blocking by HTTP pipelining
- HTTP is poll mode, not bidirectional: http协议和websocket协议的区别
- Multiplexing over single TCP connection
- HTTP2 vs WebSocket
- WebSocket is bidirectional; HTTP2 is client/server + server push
- TChannel: RPC, multiplexing, bi-directional message passing, fast forwarding, work shedding with deadlines, cancellation, speculative execution, and communicates more clearly about when and when not to retry.
- Improve Web Speed: client -> DNS resolver -> DNS -> DNS resolver -> client --req--> Web server
- Speed = DNS latency + Request latency. Which DNS has lowest latency? Can't measure directly because of DNS resolver delegates the name resolution. Solution: create a special hostname to resolve (avoid cache), latency = server access time - special hostname resolve time
DNS resolvers
- clear DNS cache
sudo killall -HUP mDNSResponder
- check DNS client: sudo lsof -i -P | grep LISTEN
- http://whoismydns.com/Index.html
- dig @127.0.0.1 -p 53 google.com +tcp +trace
TCP
- Connection Reset: the peer rejects it with an RST to let you know it isn't listening.
- send() returns only means transmitted through interface
Load Balancer
- 网络地址转换NAT原理及应用
- Consistent Hash for routing
- LVS
- LVS包转发模型和调度算法(图)
- LVS full-NAT (详解SNAT+DNAT): DR只能在同一个网段, DR和NAT必须在同一个VLAN
- https://www.quora.com/What-is-the-difference-between-layer-3-and-layer-4-load-balancing-Why-is-layer-7-LB-used-inspite-of-its-drawbacks-of-being-a-bottleneck
- https://www.nginx.com/resources/glossary/layer-4-load-balancing/
- L7 load-balancing is better for data locality on same type data
课外加强阅读
- 网络地址转换NAT原理及应用
- Consistent Hash for routing
- LVS
- LVS包转发模型和调度算法(图)
- LVS full-NAT (详解SNAT+DNAT): DR只能在同一个网段, DR和NAT必须在同一个VLAN
- https://www.quora.com/What-is-the-difference-between-layer-3-and-layer-4-load-balancing-Why-is-layer-7-LB-used-inspite-of-its-drawbacks-of-being-a-bottleneck
- https://www.nginx.com/resources/glossary/layer-4-load-balancing/
- L7 load-balancing is better for data locality on same type data