Anonymous User
February 05, 2012 11:14AM
Author: mdounin
Date: 2012-02-05 16:12:55 +0000 (Sun, 05 Feb 2012)
New Revision: 4443

Log:
Merge of r4384, r4385:

Fixes for limit_rate:

*) Fixed throughput problems with large limit_rate.

Previous attempt to fix this was in r1658 (0.6.18), though that one
wasn't enough (it was a noop).

*) Fixed interaction of limit_rate and sendfile_max_chunk.

It's possible that configured limit_rate will permit more bytes per
single operation than sendfile_max_chunk. To protect disk from
takeover by a single client it is necessary to apply sendfile_max_chunk
as a limit regardless of configured limit_rate.

See here for report (in Russian):
http://mailman.nginx.org/pipermail/nginx-ru/2010-March/032806.html


Modified:
branches/stable-1.0/
branches/stable-1.0/src/http/ngx_http_write_filter_module.c


Property changes on: branches/stable-1.0
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:3960-3974,3977-3987,3991-3996,3998,4000-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143-4144,4147-4158,4177,4179,4182-4184,4186-4187,4189-4205,4207,4209-4210,4212,4217-4223,4227-4232,4235-4237,4265-4268,4270,4274-4276,4278-4280,4282-4284,4294-4295,4298,4300-4309,4313,4315,4320-4321,4326-4327,4335-4336,4338-4343,4372-4375,4377,4379,4381-4383,4400,4403
+ /trunk:3960-3974,3977-3987,3991-3996,3998,4000-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143-4144,4147-4158,4177,4179,4182-4184,4186-4187,4189-4205,4207,4209-4210,4212,4217-4223,4227-4232,4235-4237,4265-4268,4270,4274-4276,4278-4280,4282-4284,4294-4295,4298,4300-4309,4313,4315,4320-4321,4326-4327,4335-4336,4338-4343,4372-4375,4377,4379,4381-4385,4400,4403

Modified: branches/stable-1.0/src/http/ngx_http_write_filter_module.c
===================================================================
--- branches/stable-1.0/src/http/ngx_http_write_filter_module.c 2012-02-05 15:51:20 UTC (rev 4442)
+++ branches/stable-1.0/src/http/ngx_http_write_filter_module.c 2012-02-05 16:12:55 UTC (rev 4443)
@@ -223,11 +223,14 @@
return NGX_AGAIN;
}

- } else if (clcf->sendfile_max_chunk) {
- limit = clcf->sendfile_max_chunk;
+ if (clcf->sendfile_max_chunk
+ && (off_t) clcf->sendfile_max_chunk < limit)
+ {
+ limit = clcf->sendfile_max_chunk;
+ }

} else {
- limit = 0;
+ limit = clcf->sendfile_max_chunk;
}

sent = c->sent;
@@ -262,17 +265,18 @@
}
}

- delay = (ngx_msec_t) ((nsent - sent) * 1000 / r->limit_rate + 1);
+ delay = (ngx_msec_t) ((nsent - sent) * 1000 / r->limit_rate);

if (delay > 0) {
+ limit = 0;
c->write->delayed = 1;
ngx_add_timer(c->write, delay);
}
+ }

- } else if (c->write->ready
- && clcf->sendfile_max_chunk
- && (size_t) (c->sent - sent)
- >= clcf->sendfile_max_chunk - 2 * ngx_pagesize)
+ if (limit
+ && c->write->ready
+ && c->sent - sent >= limit - (off_t) (2 * ngx_pagesize))
{
c->write->delayed = 1;
ngx_add_timer(c->write, 1);

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

[nginx] svn commit: r4443 - in branches/stable-1.0: . src/http

Anonymous User 1182 February 05, 2012 11:14AM



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

Online Users

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