[PATCH] Optimal performance when use http non-persistent connection

Maxim Dounin mdounin at mdounin.ru
Wed Nov 20 14:29:02 UTC 2019


Hello!

On Mon, Nov 11, 2019 at 03:07:02AM +0000, Zhangshaokun wrote:

> # HG changeset patch
> # User Rui Sun <sunrui26 at huawei.com<mailto:sunrui26 at huawei.com>>
> # Date 1572848389 -28800
> #      Mon Nov 04 14:19:49 2019 +0800
> # Branch local
> # Node ID a5ae6e9e99f747fcb45082bac8795622938184f1
> # Parent  89adf49fe76ada86d84e2af8f5cee9ca8c3dca19
> Optimal performance when use http non-persistent connection
> 
> diff -r 89adf49fe76a -r a5ae6e9e99f7 src/core/ngx_cycle.c
> --- a/src/core/ngx_cycle.c        Mon Oct 21 20:22:30 2019 +0300
> +++ b/src/core/ngx_cycle.c     Mon Nov 04 14:19:49 2019 +0800
> @@ -35,6 +35,40 @@
> /* STUB */
> 
> 
> +void
> +ngx_change_pid_core(ngx_cycle_t *cycle)
> +{
> +    ngx_pid_t           setpid;
> +    ngx_cpuset_t        *setaffinity=NULL;
> +    setpid = ngx_getpid();
> +    {
> +#if (NGX_HAVE_CPU_AFFINITY)
> +        ngx_core_conf_t  *ccf;
> +
> +        ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
> +
> +        if (ccf->cpu_affinity == NULL) {
> +            setaffinity = NULL;
> +        }
> +
> +        if (ccf->cpu_affinity_auto) {
> +           setaffinity = NULL;
> +        }
> +
> +        setaffinity = &ccf->cpu_affinity[0];
> +
> +#else
> +
> +        setaffinity = NULL;
> +
> +#endif
> +    }
> +
> +    if (setaffinity)
> +           // set new mask
> +        sched_setaffinity(setpid, sizeof(ngx_cpuset_t), setaffinity);
> +}
> +
> ngx_cycle_t *
> ngx_init_cycle(ngx_cycle_t *old_cycle)
> {
> @@ -278,6 +312,8 @@
>          return NULL;
>      }
> 
> +    ngx_change_pid_core(cycle);
> +
>      if (ngx_test_config && !ngx_quiet_mode) {
>          ngx_log_stderr(0, "the configuration file %s syntax is ok",
>                         cycle->conf_file.data);
> 

Sorry, but it is not clear what you are trying to achieve with 
this patch.  You may want to provide more details.

Additionally, please make sure to check the "Contributing Changes" 
article, as available here:

http://nginx.org/en/docs/contributing_changes.html

It contains some hints on how to submit patches.  Thanks.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx-devel mailing list