Страница 1 из 1

опция refresh_pattern в squid

Добавлено: 2008-05-31 16:39:14
IOpiyc
# TAG: refresh_pattern
# usage: refresh_pattern [-i] regex min percent max [options]

примеры из конфига:
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320

# Basically a cached object is:
#
# FRESH if expires < now, else STALE
# STALE if age > max
# FRESH if lm-factor < percent, else STALE
# FRESH if age < min
# else STALE
подскажите плз, что значит параметр "percent", а то что-то никак не догоню.
от чего этот процент берется и с чем сравнивается?
С мин и макс - понятно, вот с % - нет

Re: опция refresh_pattern в squid

Добавлено: 2009-03-09 2:05:19
Alex Keda
х.з. =)

Re: опция refresh_pattern в squid

Добавлено: 2013-04-26 16:00:51
Я

Re: опция refresh_pattern в squid

Добавлено: 2013-10-03 20:50:14
BezBashka
The refresh_pattern syntax is as follows:
refresh_pattern [-i] regexp min percent max [options]

For example:
refresh_pattern -i \.jpg$ 30 50% 4320 reload-into-ims
response age: время прошедшее с тех пор как оригинальный сервер сгенерировал response или время последней проверки (ИМХО на рисунке это Date). response age = NOW - Date
resource age: разница между Last-Modified header и Date header. resource age = Date - Last-Modified
LM-factor: отношение response age к resource age. LM-factor = response age/resource age

Как работает Squid refresh_pattern алгоритм:
  • Если response age > refresh_pattern max value тогда response STALE
  • Если LM-factor < refresh_pattern percent value тогда response FRESH
  • Если response age < refresh_pattern min value тогда response FRESH
  • Иначе response STALE
Изображение
http://etutorials.org/Server+Administra ... h_pattern/
Responses that fall between the minimum and maximum are subject to Squid's last-modified factor (LM-factor) algorithm. For such responses, Squid calculates the response age and the LM-factor and compares it to the percent value. The response age is simply the amount of time passed since the origin server generated, or last validated, the response. The resource age is the difference between the Last-Modified and Date headers. The LM-factor is the ratio of the response age to the resource age.

Figure 7-2 demonstrates the LM-factor algorithm. Squid caches an object that is 3 hours old (based on the Date and Last-Modified headers). With an LM-factor value of 50%, the response will be fresh for the next 1.5 hours, after which the object expires and is considered stale. If a user requests the cached object during the fresh period, Squid returns an unvalidated cache hit. For a request that occurs during the stale period, Squid forwards a validation request to the origin server.

It's important to understand the order that Squid checks the various values. Here is a simplified description of Squid's refresh_pattern algorithm:
  • The response is stale if the response age is greater than the refresh_pattern max value.
  • The response is fresh if the LM-factor is less than the refresh_pattern percent value.
  • The response is fresh if the response age is less than the refresh_pattern min value.
  • Otherwise, the response is stale.