Welcome! Log In Create A New Profile

Advanced

[PATCH] rename apache_like pm

Posted by Jérôme Loyet 
Jérôme Loyet
[PATCH] rename apache_like pm
November 16, 2009 05:44PM
Hi guys,

I'm providing this patch because I don't feel good about the
apache_like name for this /* not yet */ working pm. In many case
php-fpm won't be used with apache but more likely with nginx or
lighthttpd. In contrast to "static" pm, it would be logic to rename
"apache_like" to "dynamic".

It's a simple patch which works.

Hope it'll help php-fpm to grow :)

++ Jerome


diff --git a/conf/php-fpm.conf.in b/conf/php-fpm.conf.in
index fb458c9..cc8617b 100644
--- a/conf/php-fpm.conf.in
+++ b/conf/php-fpm.conf.in
@@ -72,7 +72,7 @@
                       <value name="pm">

                               Sets style of controling worker process count.
-                               Valid values are 'static' and 'apache-like'
+                               Valid values are 'static' and 'dynamic'
                               <value name="style">static</value>

                               Sets the limit on the number of
simultaneous requests that will be served.
@@ -81,19 +81,19 @@
                               Used with any pm_style.
                               <value name="max_children">5</value>

-                               Settings group for 'apache-like' pm style
-                               <value name="apache_like">
+                               Settings group for 'dynamic' pm style
+                               <value name="dynamic">

                                       Sets the number of server
processes created on startup.
-                                       Used only when 'apache-like'
pm_style is selected
+                                       Used only when 'dynamic'
pm_style is selected
                                       <value name="StartServers">20</value>

                                       Sets the desired minimum number
of idle server processes.
-                                       Used only when 'apache-like'
pm_style is selected
+                                       Used only when 'dynamic'
pm_style is selected
                                       <value name="MinSpareServers">5</value>

                                       Sets the desired maximum number
of idle server processes.
-                                       Used only when 'apache-like'
pm_style is selected
+                                       Used only when 'dynamic'
pm_style is selected
                                       <value name="MaxSpareServers">35</value>

                               </value>
diff --git a/fpm/fpm_conf.c b/fpm/fpm_conf.c
index 48dc371..69ef7be 100644
--- a/fpm/fpm_conf.c
+++ b/fpm/fpm_conf.c
@@ -86,8 +86,8 @@ static char *fpm_conf_set_pm_style(void **conf, char
*name, void *vv, intptr_t o
       if (!strcmp(value, "static")) {
               c->style = PM_STYLE_STATIC;
       }
-       else if (!strcmp(value, "apache-like")) {
-               c->style = PM_STYLE_APACHE_LIKE;
+       else if (!strcmp(value, "dynamic")) {
+               c->style = PM_STYLE_DYNAMIC;
       }
       else {
               return "invalid value for 'style'";
@@ -137,19 +137,19 @@ static char
*fpm_conf_set_catch_workers_output(void **conf, char *name, void *vv
       return NULL;
 }

-static struct xml_conf_section fpm_conf_set_apache_like_subsection_conf = {
-       .path = "apache_like somewhere", /* fixme */
+static struct xml_conf_section fpm_conf_set_dynamic_subsection_conf = {
+       .path = "dynamic somewhere", /* fixme */
       .parsers = (struct xml_value_parser []) {
-               { XML_CONF_SCALAR, "StartServers",
&xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
options_apache_like.StartServers) },
-               { XML_CONF_SCALAR, "MinSpareServers",
&xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
options_apache_like.MinSpareServers) },
-               { XML_CONF_SCALAR, "MaxSpareServers",
&xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
options_apache_like.MaxSpareServers) },
+               { XML_CONF_SCALAR, "StartServers",
&xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
options_dynamic.StartServers) },
+               { XML_CONF_SCALAR, "MinSpareServers",
&xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
options_dynamic.MinSpareServers) },
+               { XML_CONF_SCALAR, "MaxSpareServers",
&xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
options_dynamic.MaxSpareServers) },
               { 0, 0, 0, 0 }
       }
 };

-static char *fpm_conf_set_apache_like_subsection(void **conf, char
*name, void *xml_node, intptr_t offset)
+static char *fpm_conf_set_dynamic_subsection(void **conf, char *name,
void *xml_node, intptr_t offset)
 {
-       return xml_conf_parse_section(conf,
&fpm_conf_set_apache_like_subsection_conf, xml_node);
+       return xml_conf_parse_section(conf,
&fpm_conf_set_dynamic_subsection_conf, xml_node);
 }

 static struct xml_conf_section fpm_conf_set_listen_options_subsection_conf = {
@@ -190,7 +190,7 @@ static struct xml_conf_section
fpm_conf_set_pm_subsection_conf = {
       .parsers = (struct xml_value_parser []) {
               { XML_CONF_SCALAR,              "style",
               &fpm_conf_set_pm_style,
        0 },
               { XML_CONF_SCALAR,              "max_children",
        &xml_conf_set_slot_integer,
offsetof(struct fpm_pm_s, max_children) },
-               { XML_CONF_SUBSECTION,  "apache_like",
 &fpm_conf_set_apache_like_subsection,           offsetof(struct
fpm_pm_s, options_apache_like) },
+               { XML_CONF_SUBSECTION,  "dynamic",
 &fpm_conf_set_dynamic_subsection,               offsetof(struct
fpm_pm_s, options_dynamic) },
               { 0, 0, 0, 0 }
       }
 };
diff --git a/fpm/fpm_conf.h b/fpm/fpm_conf.h
index 4dd011e..2e06928 100644
--- a/fpm/fpm_conf.h
+++ b/fpm/fpm_conf.h
@@ -31,7 +31,7 @@ struct fpm_pm_s {
               int StartServers;
               int MinSpareServers;
               int MaxSpareServers;
-       } options_apache_like;
+       } options_dynamic;
 };

 struct fpm_listen_options_s {
@@ -62,7 +62,7 @@ struct fpm_worker_pool_config_s {
       unsigned catch_workers_output:1;
 };

-enum { PM_STYLE_STATIC = 1, PM_STYLE_APACHE_LIKE = 2 };
+enum { PM_STYLE_STATIC = 1, PM_STYLE_DYNAMIC = 2 };

 int fpm_conf_init_main();
 int fpm_worker_pool_config_free(struct fpm_worker_pool_config_s *wpc);
Re: [PATCH] rename apache_like pm
November 16, 2009 05:48PM
what about "adaptive" ? or prefork, worker, stuff like that...

in theory it will be reactive or adaptive based on the number of
requests and things like that

2009/11/16 Jérôme Loyet <ml@fatbsd.com>:
> Hi guys,
>
> I'm providing this patch because I don't feel good about the
> apache_like name for this /* not yet */ working pm. In many case
> php-fpm won't be used with apache but more likely with nginx or
> lighthttpd. In contrast to "static" pm, it would be logic to rename
> "apache_like" to "dynamic".
>
> It's a simple patch which works.
>
> Hope it'll help php-fpm to grow :)
>
> ++ Jerome
>
>
> diff --git a/conf/php-fpm.conf.in b/conf/php-fpm.conf.in
> index fb458c9..cc8617b 100644
> --- a/conf/php-fpm.conf.in
> +++ b/conf/php-fpm.conf.in
> @@ -72,7 +72,7 @@
>                        <value name="pm">
>
>                                Sets style of controling worker process count.
> -                               Valid values are 'static' and 'apache-like'
> +                               Valid values are 'static' and 'dynamic'
>                                <value name="style">static</value>
>
>                                Sets the limit on the number of
> simultaneous requests that will be served.
> @@ -81,19 +81,19 @@
>                                Used with any pm_style.
>                                <value name="max_children">5</value>
>
> -                               Settings group for 'apache-like' pm style
> -                               <value name="apache_like">
> +                               Settings group for 'dynamic' pm style
> +                               <value name="dynamic">
>
>                                        Sets the number of server
> processes created on startup.
> -                                       Used only when 'apache-like'
> pm_style is selected
> +                                       Used only when 'dynamic'
> pm_style is selected
>                                        <value name="StartServers">20</value>
>
>                                        Sets the desired minimum number
> of idle server processes.
> -                                       Used only when 'apache-like'
> pm_style is selected
> +                                       Used only when 'dynamic'
> pm_style is selected
>                                        <value name="MinSpareServers">5</value>
>
>                                        Sets the desired maximum number
> of idle server processes.
> -                                       Used only when 'apache-like'
> pm_style is selected
> +                                       Used only when 'dynamic'
> pm_style is selected
>                                        <value name="MaxSpareServers">35</value>
>
>                                </value>
> diff --git a/fpm/fpm_conf.c b/fpm/fpm_conf.c
> index 48dc371..69ef7be 100644
> --- a/fpm/fpm_conf.c
> +++ b/fpm/fpm_conf.c
> @@ -86,8 +86,8 @@ static char *fpm_conf_set_pm_style(void **conf, char
> *name, void *vv, intptr_t o
>        if (!strcmp(value, "static")) {
>                c->style = PM_STYLE_STATIC;
>        }
> -       else if (!strcmp(value, "apache-like")) {
> -               c->style = PM_STYLE_APACHE_LIKE;
> +       else if (!strcmp(value, "dynamic")) {
> +               c->style = PM_STYLE_DYNAMIC;
>        }
>        else {
>                return "invalid value for 'style'";
> @@ -137,19 +137,19 @@ static char
> *fpm_conf_set_catch_workers_output(void **conf, char *name, void *vv
>        return NULL;
>  }
>
> -static struct xml_conf_section fpm_conf_set_apache_like_subsection_conf = {
> -       .path = "apache_like somewhere", /* fixme */
> +static struct xml_conf_section fpm_conf_set_dynamic_subsection_conf = {
> +       .path = "dynamic somewhere", /* fixme */
>        .parsers = (struct xml_value_parser []) {
> -               { XML_CONF_SCALAR, "StartServers",
> &xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
> options_apache_like.StartServers) },
> -               { XML_CONF_SCALAR, "MinSpareServers",
> &xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
> options_apache_like.MinSpareServers) },
> -               { XML_CONF_SCALAR, "MaxSpareServers",
> &xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
> options_apache_like.MaxSpareServers) },
> +               { XML_CONF_SCALAR, "StartServers",
> &xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
> options_dynamic.StartServers) },
> +               { XML_CONF_SCALAR, "MinSpareServers",
> &xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
> options_dynamic.MinSpareServers) },
> +               { XML_CONF_SCALAR, "MaxSpareServers",
> &xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
> options_dynamic.MaxSpareServers) },
>                { 0, 0, 0, 0 }
>        }
>  };
>
> -static char *fpm_conf_set_apache_like_subsection(void **conf, char
> *name, void *xml_node, intptr_t offset)
> +static char *fpm_conf_set_dynamic_subsection(void **conf, char *name,
> void *xml_node, intptr_t offset)
>  {
> -       return xml_conf_parse_section(conf,
> &fpm_conf_set_apache_like_subsection_conf, xml_node);
> +       return xml_conf_parse_section(conf,
> &fpm_conf_set_dynamic_subsection_conf, xml_node);
>  }
>
>  static struct xml_conf_section fpm_conf_set_listen_options_subsection_conf = {
> @@ -190,7 +190,7 @@ static struct xml_conf_section
> fpm_conf_set_pm_subsection_conf = {
>        .parsers = (struct xml_value_parser []) {
>                { XML_CONF_SCALAR,              "style",
>                 &fpm_conf_set_pm_style,
>          0 },
>                { XML_CONF_SCALAR,              "max_children",
>         &xml_conf_set_slot_integer,
>  offsetof(struct fpm_pm_s, max_children) },
> -               { XML_CONF_SUBSECTION,  "apache_like",
>  &fpm_conf_set_apache_like_subsection,           offsetof(struct
> fpm_pm_s, options_apache_like) },
> +               { XML_CONF_SUBSECTION,  "dynamic",
>  &fpm_conf_set_dynamic_subsection,               offsetof(struct
> fpm_pm_s, options_dynamic) },
>                { 0, 0, 0, 0 }
>        }
>  };
> diff --git a/fpm/fpm_conf.h b/fpm/fpm_conf.h
> index 4dd011e..2e06928 100644
> --- a/fpm/fpm_conf.h
> +++ b/fpm/fpm_conf.h
> @@ -31,7 +31,7 @@ struct fpm_pm_s {
>                int StartServers;
>                int MinSpareServers;
>                int MaxSpareServers;
> -       } options_apache_like;
> +       } options_dynamic;
>  };
>
>  struct fpm_listen_options_s {
> @@ -62,7 +62,7 @@ struct fpm_worker_pool_config_s {
>        unsigned catch_workers_output:1;
>  };
>
> -enum { PM_STYLE_STATIC = 1, PM_STYLE_APACHE_LIKE = 2 };
> +enum { PM_STYLE_STATIC = 1, PM_STYLE_DYNAMIC = 2 };
>
>  int fpm_conf_init_main();
>  int fpm_worker_pool_config_free(struct fpm_worker_pool_config_s *wpc);
>
Jérôme Loyet
Re: [PATCH] rename apache_like pm
November 16, 2009 05:52PM
2009/11/16 Michael Shadle <mike503@gmail.com>:
> what about "adaptive" ? or prefork, worker, stuff like that...

adaptative sound good too. Dynamic is the opposite of static, so
that's why I choosed this one but it's a proposal.

About prefork or worker, in my opinion, it sounds too close from
apache. In this case, it could be named tomcat_like or whatever
software using dynamic forking on demand.

>
> in theory it will be reactive or adaptive based on the number of
> requests and things like that
>
> 2009/11/16 Jérôme Loyet <ml@fatbsd.com>:
>> Hi guys,
>>
>> I'm providing this patch because I don't feel good about the
>> apache_like name for this /* not yet */ working pm. In many case
>> php-fpm won't be used with apache but more likely with nginx or
>> lighthttpd. In contrast to "static" pm, it would be logic to rename
>> "apache_like" to "dynamic".
>>
>> It's a simple patch which works.
>>
>> Hope it'll help php-fpm to grow :)
>>
>> ++ Jerome
>>
>>
>> diff --git a/conf/php-fpm.conf.in b/conf/php-fpm.conf.in
>> index fb458c9..cc8617b 100644
>> --- a/conf/php-fpm.conf.in
>> +++ b/conf/php-fpm.conf.in
>> @@ -72,7 +72,7 @@
>>                        <value name="pm">
>>
>>                                Sets style of controling worker process count.
>> -                               Valid values are 'static' and 'apache-like'
>> +                               Valid values are 'static' and 'dynamic'
>>                                <value name="style">static</value>
>>
>>                                Sets the limit on the number of
>> simultaneous requests that will be served.
>> @@ -81,19 +81,19 @@
>>                                Used with any pm_style.
>>                                <value name="max_children">5</value>
>>
>> -                               Settings group for 'apache-like' pm style
>> -                               <value name="apache_like">
>> +                               Settings group for 'dynamic' pm style
>> +                               <value name="dynamic">
>>
>>                                        Sets the number of server
>> processes created on startup.
>> -                                       Used only when 'apache-like'
>> pm_style is selected
>> +                                       Used only when 'dynamic'
>> pm_style is selected
>>                                        <value name="StartServers">20</value>
>>
>>                                        Sets the desired minimum number
>> of idle server processes.
>> -                                       Used only when 'apache-like'
>> pm_style is selected
>> +                                       Used only when 'dynamic'
>> pm_style is selected
>>                                        <value name="MinSpareServers">5</value>
>>
>>                                        Sets the desired maximum number
>> of idle server processes.
>> -                                       Used only when 'apache-like'
>> pm_style is selected
>> +                                       Used only when 'dynamic'
>> pm_style is selected
>>                                        <value name="MaxSpareServers">35</value>
>>
>>                                </value>
>> diff --git a/fpm/fpm_conf.c b/fpm/fpm_conf.c
>> index 48dc371..69ef7be 100644
>> --- a/fpm/fpm_conf.c
>> +++ b/fpm/fpm_conf.c
>> @@ -86,8 +86,8 @@ static char *fpm_conf_set_pm_style(void **conf, char
>> *name, void *vv, intptr_t o
>>        if (!strcmp(value, "static")) {
>>                c->style = PM_STYLE_STATIC;
>>        }
>> -       else if (!strcmp(value, "apache-like")) {
>> -               c->style = PM_STYLE_APACHE_LIKE;
>> +       else if (!strcmp(value, "dynamic")) {
>> +               c->style = PM_STYLE_DYNAMIC;
>>        }
>>        else {
>>                return "invalid value for 'style'";
>> @@ -137,19 +137,19 @@ static char
>> *fpm_conf_set_catch_workers_output(void **conf, char *name, void *vv
>>        return NULL;
>>  }
>>
>> -static struct xml_conf_section fpm_conf_set_apache_like_subsection_conf = {
>> -       .path = "apache_like somewhere", /* fixme */
>> +static struct xml_conf_section fpm_conf_set_dynamic_subsection_conf = {
>> +       .path = "dynamic somewhere", /* fixme */
>>        .parsers = (struct xml_value_parser []) {
>> -               { XML_CONF_SCALAR, "StartServers",
>> &xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
>> options_apache_like.StartServers) },
>> -               { XML_CONF_SCALAR, "MinSpareServers",
>> &xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
>> options_apache_like.MinSpareServers) },
>> -               { XML_CONF_SCALAR, "MaxSpareServers",
>> &xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
>> options_apache_like.MaxSpareServers) },
>> +               { XML_CONF_SCALAR, "StartServers",
>> &xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
>> options_dynamic.StartServers) },
>> +               { XML_CONF_SCALAR, "MinSpareServers",
>> &xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
>> options_dynamic.MinSpareServers) },
>> +               { XML_CONF_SCALAR, "MaxSpareServers",
>> &xml_conf_set_slot_integer, offsetof(struct fpm_pm_s,
>> options_dynamic.MaxSpareServers) },
>>                { 0, 0, 0, 0 }
>>        }
>>  };
>>
>> -static char *fpm_conf_set_apache_like_subsection(void **conf, char
>> *name, void *xml_node, intptr_t offset)
>> +static char *fpm_conf_set_dynamic_subsection(void **conf, char *name,
>> void *xml_node, intptr_t offset)
>>  {
>> -       return xml_conf_parse_section(conf,
>> &fpm_conf_set_apache_like_subsection_conf, xml_node);
>> +       return xml_conf_parse_section(conf,
>> &fpm_conf_set_dynamic_subsection_conf, xml_node);
>>  }
>>
>>  static struct xml_conf_section fpm_conf_set_listen_options_subsection_conf = {
>> @@ -190,7 +190,7 @@ static struct xml_conf_section
>> fpm_conf_set_pm_subsection_conf = {
>>        .parsers = (struct xml_value_parser []) {
>>                { XML_CONF_SCALAR,              "style",
>>                 &fpm_conf_set_pm_style,
>>          0 },
>>                { XML_CONF_SCALAR,              "max_children",
>>         &xml_conf_set_slot_integer,
>>  offsetof(struct fpm_pm_s, max_children) },
>> -               { XML_CONF_SUBSECTION,  "apache_like",
>>  &fpm_conf_set_apache_like_subsection,           offsetof(struct
>> fpm_pm_s, options_apache_like) },
>> +               { XML_CONF_SUBSECTION,  "dynamic",
>>  &fpm_conf_set_dynamic_subsection,               offsetof(struct
>> fpm_pm_s, options_dynamic) },
>>                { 0, 0, 0, 0 }
>>        }
>>  };
>> diff --git a/fpm/fpm_conf.h b/fpm/fpm_conf.h
>> index 4dd011e..2e06928 100644
>> --- a/fpm/fpm_conf.h
>> +++ b/fpm/fpm_conf.h
>> @@ -31,7 +31,7 @@ struct fpm_pm_s {
>>                int StartServers;
>>                int MinSpareServers;
>>                int MaxSpareServers;
>> -       } options_apache_like;
>> +       } options_dynamic;
>>  };
>>
>>  struct fpm_listen_options_s {
>> @@ -62,7 +62,7 @@ struct fpm_worker_pool_config_s {
>>        unsigned catch_workers_output:1;
>>  };
>>
>> -enum { PM_STYLE_STATIC = 1, PM_STYLE_APACHE_LIKE = 2 };
>> +enum { PM_STYLE_STATIC = 1, PM_STYLE_DYNAMIC = 2 };
>>
>>  int fpm_conf_init_main();
>>  int fpm_worker_pool_config_free(struct fpm_worker_pool_config_s *wpc);
>>
>
grigori
Re: rename apache_like pm
November 17, 2009 05:00AM
For me sounds like a nonsense - discussing the new name of the absent
function when nobody can implement it.


On 17 ноя, 00:51, Jérôme Loyet <m...@fatbsd.com> wrote:
> 2009/11/16 Michael Shadle <mike...@gmail.com>:
>
> > what about "adaptive" ? or prefork, worker, stuff like that...
>
> adaptative sound good too. Dynamic is the opposite of static, so
> that's why I choosed this one but it's a proposal.
Re: rename apache_like pm
November 17, 2009 05:04AM
Not "nobody" just nobody has stepped up yet. I've been shopping around
to anyone who can hack C.

On Tue, Nov 17, 2009 at 1:58 AM, grigori <grigori.kochanov@gmail.com> wrote:
> For me sounds like a nonsense - discussing the new name of the absent
> function when nobody can implement it.
>
>
> On 17 ноя, 00:51, Jérôme Loyet <m...@fatbsd.com> wrote:
>> 2009/11/16 Michael Shadle <mike...@gmail.com>:
>>
>> > what about "adaptive" ? or prefork, worker, stuff like that...
>>
>> adaptative sound good too. Dynamic is the opposite of static, so
>> that's why I choosed this one but it's a proposal.
>
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 315
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready