varnish配置文件的pipe和pass区别

varnish下的pipe和pass理解起来颇费了些脑细胞。以下是varnish官网的文档解释(v2.1).

vcl_pipe

Called upon entering pipe mode. In this mode, the request is passed on to the backend, and any further data from either client or backend is passed on unaltered until either end closes the connection.

【我的理解是这样的:当某一请求进入pipe模式后,当前连接下的请求及后续请求都会以同样的方式处理,即客户端和后端服务器直接交换数据,varnish只负责传输数据,不再有其它干预,直到该链接关闭。】

vcl_pass

Called upon entering pass mode. In this mode, the request is passed on to the backend, and the backend’s response is passed on to the client, but is not entered into the cache. Subsequent requests sub‐ mitted over the same client connection are handled normally.

当某一请求进入pass模式后,当前请求会被交给后端服务器处理(不会去lookup),后端服务器的响应交付给客户端,但是不会进入缓存,当前链接的后续请求会正常处理,即仍然要走完整个varnish的处理流程。

 

在实际应用中,一定要注意两者的区别,按照实际业务需要慎重选择。

原文地址:https://www.cnblogs.com/huayumeng/p/2665795.html