Welcome! Log In Create A New Profile

Advanced

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

Shaokun Zhang
November 21, 2019 06:24AM
Hi Maixm,

On 2019/11/20 22:29, Maxim Dounin wrote:
> Hello!
>
> On Mon, Nov 11, 2019 at 03:07:02AM +0000, Zhangshaokun wrote:
>
>> # HG changeset patch
>> # User Rui Sun <sunrui26@huawei.com<mailto:sunrui26@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.
>

when we test nginx in kunpeng920 which has 2chip and each chip has 2 NUMA.
We user 32cores in 2 different NUMA to test nginx, when nginx start the master
worker runs on which core is undefined, when the master's core and the
worker's core in the same chip, the performance of non-persistent connection
is 17W, but when master's core and the worker's core in the different chip,
the performance of non-persistent connection only has 12W. Now, when nginx
start, we migrate master process depend on the first worker process's cpu
affinity, the performance is showed as follow:
| default| optimize
master and worker process on same chip when nginx start | 171699 | 176020
master and worker process on diff chip when nginx start | 129639 | 180637

Thanks,
Shaokun

> 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.
>

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

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

Zhangshaokun 391 November 10, 2019 10:08PM

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

Maxim Dounin 150 November 20, 2019 09:30AM

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

Shaokun Zhang 126 November 21, 2019 06:24AM

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

Maxim Dounin 157 November 21, 2019 10:22AM

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

Shaokun Zhang 171 December 01, 2019 10:24PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 179
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