开始/停止花费太多时间

nix*_*win 8 squid services

在我的 ubuntu 机器上,我将squid3作为在启动时启动的守护进程。

问题是squid3需要很长时间才能启动和停止(超过 30 秒),而且它也大大减慢了我的操作系统启动/关闭时间。

我该如何解决这个问题?

Chr*_*ard 15

有一个参数叫做shutdown_lifetime。它的默认值为 30 秒。

因此,当 Squid 收到关闭请求时,它会等待至少 30 秒才能终止。

$ grep -B 8 "# shutdown_lifetime" /etc/squid3/squid.conf 

#  TAG: shutdown_lifetime   time-units
#   When SIGTERM or SIGHUP is received, the cache is put into
#   "shutdown pending" mode until all active sockets are closed.
#   This value is the lifetime to set for all open descriptors
#   during shutdown mode.  Any active clients after this many
#   seconds will receive a 'timeout' message.
# Default:
# shutdown_lifetime 30 seconds
Run Code Online (Sandbox Code Playgroud)

只需“取消注释”最后一行并设置更短的时间:

shutdown_lifetime 10 seconds 
Run Code Online (Sandbox Code Playgroud)

有关更多信息,请参见下文。

http://www.squid-cache.org/Doc/config/shutdown_lifetime/