1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

The following now respects DefaultRuntimeDir/DEFAULT_REL_RUNTIMEDIR:

- mod_cache: thundering herd lock directory


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1407381 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jeff Trawick
2012-11-09 08:44:08 +00:00
parent 9e0df917dd
commit 85ec79e3ce
4 changed files with 13 additions and 16 deletions

View File

@@ -147,6 +147,7 @@ Changes with Apache 2.5.0
- APIs: ap_log_pid(), ap_remove_pid, ap_read_pid() - APIs: ap_log_pid(), ap_remove_pid, ap_read_pid()
- core: the scoreboard (ScoreBoardFile), pid file (PidFile), and - core: the scoreboard (ScoreBoardFile), pid file (PidFile), and
mutexes (Mutex) mutexes (Mutex)
- mod_cache: thundering herd lock directory
- mod_lbmethod_heartbeat, mod_heartmonitor: heartbeat storage file - mod_lbmethod_heartbeat, mod_heartmonitor: heartbeat storage file
- mod_ldap: shared memory cache - mod_ldap: shared memory cache
- mod_socache_shmcb, mod_socache_dbm: shared memory or dbm for cache - mod_socache_shmcb, mod_socache_dbm: shared memory or dbm for cache

View File

@@ -855,13 +855,15 @@ LastModified date.</description>
for the given URL space.</p> for the given URL space.</p>
<p>In a minimal configuration the following directive is all that is needed to <p>In a minimal configuration the following directive is all that is needed to
enable the thundering herd lock in the default system temp directory.</p> enable the thundering herd lock in the default run-time file directory.</p>
<highlight language="config"> <highlight language="config">
# Enable cache lock # Enable cache lock
CacheLock on CacheLock on
</highlight> </highlight>
<p>Locks consist of empty files that only exist for stale URLs in flight, so this
is significantly less resource intensive than the traditional disk cache.</p>
</usage> </usage>
</directivesynopsis> </directivesynopsis>
@@ -869,17 +871,15 @@ CacheLock on
<name>CacheLockPath</name> <name>CacheLockPath</name>
<description>Set the lock path directory.</description> <description>Set the lock path directory.</description>
<syntax>CacheLockPath <var>directory</var></syntax> <syntax>CacheLockPath <var>directory</var></syntax>
<default>CacheLockPath /tmp/mod_cache-lock</default> <default>CacheLockPath mod_cache-lock</default>
<contextlist><context>server config</context><context>virtual host</context> <contextlist><context>server config</context><context>virtual host</context>
</contextlist> </contextlist>
<usage> <usage>
<p>The <directive>CacheLockPath</directive> directive allows you to specify the <p>The <directive>CacheLockPath</directive> directive allows you to specify the
directory in which the locks are created. By default, the system's temporary directory in which the locks are created. If <var>directory</var> is not an absolute
folder is used. Locks consist of empty files that only exist for stale URLs path, the location specified will be relative to the value of
in flight, so is significantly less resource intensive than the traditional <directive module="core">DefaultRuntimeDir</directive>.</p>
disk cache.</p>
</usage> </usage>
</directivesynopsis> </directivesynopsis>

View File

@@ -95,7 +95,7 @@ extern "C" {
#define DEFAULT_X_CACHE 0 #define DEFAULT_X_CACHE 0
#define DEFAULT_X_CACHE_DETAIL 0 #define DEFAULT_X_CACHE_DETAIL 0
#define DEFAULT_CACHE_STALE_ON_ERROR 1 #define DEFAULT_CACHE_STALE_ON_ERROR 1
#define DEFAULT_CACHE_LOCKPATH "/mod_cache-lock" #define DEFAULT_CACHE_LOCKPATH "mod_cache-lock"
#define CACHE_LOCKNAME_KEY "mod_cache-lockname" #define CACHE_LOCKNAME_KEY "mod_cache-lockname"
#define CACHE_LOCKFILE_KEY "mod_cache-lockfile" #define CACHE_LOCKFILE_KEY "mod_cache-lockfile"
#define CACHE_CTX_KEY "mod_cache-ctx" #define CACHE_CTX_KEY "mod_cache-ctx"

View File

@@ -1801,7 +1801,6 @@ static void *merge_dir_config(apr_pool_t *p, void *basev, void *addv) {
static void * create_cache_config(apr_pool_t *p, server_rec *s) static void * create_cache_config(apr_pool_t *p, server_rec *s)
{ {
const char *tmppath;
cache_server_conf *ps = apr_pcalloc(p, sizeof(cache_server_conf)); cache_server_conf *ps = apr_pcalloc(p, sizeof(cache_server_conf));
/* array of URL prefixes for which caching is enabled */ /* array of URL prefixes for which caching is enabled */
@@ -1824,10 +1823,7 @@ static void * create_cache_config(apr_pool_t *p, server_rec *s)
ps->ignore_session_id_set = CACHE_IGNORE_SESSION_ID_UNSET; ps->ignore_session_id_set = CACHE_IGNORE_SESSION_ID_UNSET;
ps->lock = 0; /* thundering herd lock defaults to off */ ps->lock = 0; /* thundering herd lock defaults to off */
ps->lock_set = 0; ps->lock_set = 0;
apr_temp_dir_get(&tmppath, p); ps->lockpath = ap_runtime_dir_relative(p, DEFAULT_CACHE_LOCKPATH);
if (tmppath) {
ps->lockpath = apr_pstrcat(p, tmppath, DEFAULT_CACHE_LOCKPATH, NULL);
}
ps->lockmaxage = apr_time_from_sec(DEFAULT_CACHE_MAXAGE); ps->lockmaxage = apr_time_from_sec(DEFAULT_CACHE_MAXAGE);
ps->x_cache = DEFAULT_X_CACHE; ps->x_cache = DEFAULT_X_CACHE;
ps->x_cache_detail = DEFAULT_X_CACHE_DETAIL; ps->x_cache_detail = DEFAULT_X_CACHE_DETAIL;
@@ -2202,7 +2198,7 @@ static const char *set_cache_lock_path(cmd_parms *parms, void *dummy,
(cache_server_conf *)ap_get_module_config(parms->server->module_config, (cache_server_conf *)ap_get_module_config(parms->server->module_config,
&cache_module); &cache_module);
conf->lockpath = ap_server_root_relative(parms->pool, arg); conf->lockpath = ap_runtime_dir_relative(parms->pool, arg);
if (!conf->lockpath) { if (!conf->lockpath) {
return apr_pstrcat(parms->pool, "Invalid CacheLockPath path ", return apr_pstrcat(parms->pool, "Invalid CacheLockPath path ",
arg, NULL); arg, NULL);
@@ -2380,8 +2376,8 @@ static const command_rec cache_cmds[] =
"Enable or disable the thundering herd lock."), "Enable or disable the thundering herd lock."),
AP_INIT_TAKE1("CacheLockPath", set_cache_lock_path, NULL, RSRC_CONF, AP_INIT_TAKE1("CacheLockPath", set_cache_lock_path, NULL, RSRC_CONF,
"The thundering herd lock path. Defaults to the '" "The thundering herd lock path. Defaults to the '"
DEFAULT_CACHE_LOCKPATH "' directory in the system " DEFAULT_CACHE_LOCKPATH "' directory relative to the "
"temp directory."), "DefaultRuntimeDir setting."),
AP_INIT_TAKE1("CacheLockMaxAge", set_cache_lock_maxage, NULL, RSRC_CONF, AP_INIT_TAKE1("CacheLockMaxAge", set_cache_lock_maxage, NULL, RSRC_CONF,
"Maximum age of any thundering herd lock."), "Maximum age of any thundering herd lock."),
AP_INIT_FLAG("CacheHeader", set_cache_x_cache, NULL, RSRC_CONF | ACCESS_CONF, AP_INIT_FLAG("CacheHeader", set_cache_x_cache, NULL, RSRC_CONF | ACCESS_CONF,