You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2020/02/07 13:41:33 UTC

svn commit: r1873738 - in /httpd/httpd/branches/2.4.x: ./ CHANGES server/config.c

Author: covener
Date: Fri Feb  7 13:41:33 2020
New Revision: 1873738

URL: http://svn.apache.org/viewvc?rev=1873738&view=rev
Log:
PR64066: config: Speed up graceful restarts 

... by using pre-hashed command table.

Backports: r1872786.


Submitted By: Giovanni Bechis <giovanni paclan.it> 
Reviewed By: jim, jorton, covener



Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/server/config.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1872786

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1873738&r1=1873737&r2=1873738&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Fri Feb  7 13:41:33 2020
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.42
 
+  *) config: Speed up graceful restarts by using pre-hashed command table. PR 64066.
+     [Giovanni Bechis <giovanni paclan.it>, Jim Jagielski]
+
   *) mod_systemd: New module providing integration with systemd.  [Jan Kaluza]
 
   *) mod_lua: Add r:headers_in_table, r:headers_out_table, r:err_headers_out_table,

Modified: httpd/httpd/branches/2.4.x/server/config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/config.c?rev=1873738&r1=1873737&r2=1873738&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/config.c (original)
+++ httpd/httpd/branches/2.4.x/server/config.c Fri Feb  7 13:41:33 2020
@@ -1118,8 +1118,9 @@ static const char *ap_build_config_sub(a
     const char *args;
     char *cmd_name;
     ap_directive_t *newdir;
-    module *mod = ap_top_module;
     const command_rec *cmd;
+    ap_mod_list *ml;
+    char *lname;
 
     if (*l == '#' || *l == '\0')
         return NULL;
@@ -1157,9 +1158,12 @@ static const char *ap_build_config_sub(a
     newdir->line_num = parms->config_file->line_number;
     newdir->args = apr_pstrdup(p, args);
 
-    if ((cmd = ap_find_command_in_modules(cmd_name, &mod)) != NULL) {
+    lname = apr_pstrdup(temp_pool, cmd_name);
+    ap_str_tolower(lname);
+    ml = apr_hash_get(ap_config_hash, lname, APR_HASH_KEY_STRING);
+
+    if (ml && (cmd = ml->cmd) != NULL) {
         newdir->directive = cmd->name;
-        
         if (cmd->req_override & EXEC_ON_READ) {
             ap_directive_t *sub_tree = NULL;