Author: rjung Date: Sun Jan 6 06:50:20 2008 New Revision: 609322 URL: http://svn.apache.org/viewvc?rev=609322&view=rev Log: Automatically determine shm size for all web servers.
Modified: tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml tomcat/connectors/trunk/jk/xdocs/reference/apache.xml tomcat/connectors/trunk/jk/xdocs/reference/iis.xml Modified: tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c?rev=609322&r1=609321&r2=609322&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c (original) +++ tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c Sun Jan 6 06:50:20 2008 @@ -220,7 +220,7 @@ static table *jk_log_fds = NULL; static jk_worker_env_t worker_env; static char *jk_shm_file = NULL; -static size_t jk_shm_size = JK_SHM_DEF_SIZE; +static size_t jk_shm_size = 0; /* * Worker stuff */ @@ -2669,6 +2669,14 @@ } #endif + if (jk_shm_size == 0) + jk_shm_size = jk_shm_calculate_size(jk_worker_properties, conf->log); + else { + jk_log(conf->log, JK_LOG_INFO, + "The optimal shared memory size can now be determined automatically."); + jk_log(conf->log, JK_LOG_INFO, + "You can remove the JkShmSize directive if you want to use the optimal size."); + } if ((rc = jk_shm_open(jk_shm_file, jk_shm_size, conf->log)) != 0) jk_log(conf->log, JK_LOG_ERROR, "Initializing shm:%s errno=%d. Load balancing workers will not function properly.", Modified: tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c?rev=609322&r1=609321&r2=609322&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c (original) +++ tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c Sun Jan 6 06:50:20 2008 @@ -231,7 +231,7 @@ static jk_worker_env_t worker_env; static apr_global_mutex_t *jk_log_lock = NULL; static char *jk_shm_file = NULL; -static size_t jk_shm_size = JK_SHM_DEF_SIZE; +static size_t jk_shm_size = 0; /* * Worker stuff */ @@ -2784,6 +2784,14 @@ "Using default %s", jk_shm_file); } #endif + if (jk_shm_size == 0) + jk_shm_size = jk_shm_calculate_size(jk_worker_properties, conf->log); + else { + jk_log(conf->log, JK_LOG_INFO, + "The optimal shared memory size can now be determined automatically."); + jk_log(conf->log, JK_LOG_INFO, + "You can remove the JkShmSize directive if you want to use the optimal size."); + } if ((rc = jk_shm_open(jk_shm_file, jk_shm_size, conf->log)) == 0) { apr_pool_cleanup_register(pconf, conf->log, jk_cleanup_shmem, jk_cleanup_shmem); Modified: tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c?rev=609322&r1=609321&r2=609322&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c (original) +++ tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c Sun Jan 6 06:50:20 2008 @@ -193,7 +193,7 @@ static char worker_mount_file[MAX_PATH * 2] = {0}; static int worker_mount_reload = JK_URIMAP_DEF_RELOAD; static char rewrite_rule_file[MAX_PATH * 2] = {0}; -static int shm_config_size = JK_SHM_DEF_SIZE; +static size_t shm_config_size = 0; static int strip_session = 0; static DWORD auth_notification_flags = 0; static int use_auth_notification_flags = 1; @@ -1762,6 +1762,14 @@ /* * Create named shared memory for each server */ + if (shm_config_size == 0) + shm_config_size = jk_shm_calculate_size(workers_map, logger); + else { + jk_log(logger, JK_LOG_INFO, + "The optimal shared memory size can now be determined automatically."); + jk_log(logger, JK_LOG_INFO, + "You can remove the JkShmSize directive if you want to use the optimal size."); + } if ((rv = jk_shm_open(shm_name, shm_config_size, logger)) != 0) jk_log(logger, JK_LOG_ERROR, "Initializing shm:%s errno=%d. Load balancing workers will not function properly.", @@ -1867,7 +1875,7 @@ ok = JK_FALSE; } } - shm_config_size = get_config_int(src, SHM_SIZE_TAG, JK_SHM_DEF_SIZE); + shm_config_size = (size_t) get_config_int(src, SHM_SIZE_TAG, 0); worker_mount_reload = get_config_int(src, WORKER_MOUNT_RELOAD_TAG, JK_URIMAP_DEF_RELOAD); strip_session = get_config_bool(src, STRIP_SESSION_TAG, JK_FALSE); use_auth_notification_flags = get_config_int(src, AUTH_COMPLETE_TAG, 1); Modified: tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c?rev=609322&r1=609321&r2=609322&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c (original) +++ tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c Sun Jan 6 06:50:20 2008 @@ -59,6 +59,7 @@ static jk_worker_env_t worker_env; static jk_map_t *init_map = NULL; static jk_uri_worker_map_t *uw_map = NULL; +static size_t jk_shm_size = 0; #ifdef NETWARE int (*PR_IsSocketSecure) (SYS_NETFD * csd); /* pointer to PR_IsSocketSecure function */ @@ -282,11 +283,13 @@ if (reject_unsafe) { jk_map_add(init_map, "worker." REJECT_UNSAFE_TAG, reject_unsafe); } - if ((rv = jk_shm_open(shm_file, JK_SHM_DEF_SIZE, logger)) != 0) { + + jk_shm_size = jk_shm_calculate_size(init_map, logger); + if ((rv = jk_shm_open(shm_file, jk_shm_size, logger)) != 0) jk_log(logger, JK_LOG_ERROR, "Initializing shm:%s errno=%d. Load balancing workers will not function properly.", jk_shm_name(), rv); - } + s = systhread_start(SYSTHREAD_DEFAULT_PRIORITY, 0, init_workers_on_other_threads, init_map); for (sleep_cnt = 0; sleep_cnt < 60; sleep_cnt++) { Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?rev=609322&r1=609321&r2=609322&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original) +++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Sun Jan 6 06:50:20 2008 @@ -44,6 +44,9 @@ <subsection name="Native"> <changelog> <update> + SHM: Automatically determine shm size for all web servers. (rjung) + </update> + <update> SHM: Make open/attach logging consistent for all web servers. (rjung) </update> <update> Modified: tomcat/connectors/trunk/jk/xdocs/reference/apache.xml URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/reference/apache.xml?rev=609322&r1=609321&r2=609322&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/xdocs/reference/apache.xml (original) +++ tomcat/connectors/trunk/jk/xdocs/reference/apache.xml Sun Jan 6 06:50:20 2008 @@ -108,6 +108,9 @@ <br/> The default value depends on the platform. It is usually less than 64KB. </p></attribute> +<p>Starting with version 1.2.27 the size of the shared memory is determined +automatically, even for large numbers of workers. This attribute is not +needed any longer.</p> <attribute name="JkMountFile" required="false"><p> File containing multiple mappings from a context to a Tomcat worker. It is usually called uriworkermap.properties. Modified: tomcat/connectors/trunk/jk/xdocs/reference/iis.xml URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/reference/iis.xml?rev=609322&r1=609321&r2=609322&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/xdocs/reference/iis.xml (original) +++ tomcat/connectors/trunk/jk/xdocs/reference/iis.xml Sun Jan 6 06:50:20 2008 @@ -98,6 +98,9 @@ (Set this value only if you have <b>more</b> then <b>64</b> workers) </p> <p>This directive has been added in version 1.2.20</p> +<p>Starting with version 1.2.27 the size of the shared memory is determined +automatically, even for large numbers of workers. This attribute is not +needed any longer.</p> </attribute> <attribute name="worker_mount_reload" required="false"><p> A DWORD value specifying the time in seconds upon which the --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]