Alvaro Lopez Ortega wrote:
Diego Giagio wrote:
> I've been working on adding bandwidth throttling support to cherokee
> and after some research i found that it's not possible to use
> sendfile() and do throttling at the same time.
>
> Would it be feasible to not use sendfile() when using throttling?
> I'm open to suggestions.
It makes sense for me if you disable the sendfile() support on the
connections under the bandwidth meter (only for those).
Oh yes, that was what i meant ;)
I mean, sendfile() is a system call Cherokee uses to optimize the
sending loop, but if the server administrator wants to enable the
traffic shaping and he can expect a slightly decrease on the global
performance.
By the way, do you want to discuss the global architecture before
start coding? It might save you some time. :-)
I'm just researching and creating some prototypes, no real coding yet. I
already have some ideas and would be great if we could talk about. They
are:
First of all we need to add some more parameters to the config files.
My suggestions are:
- MaxServerThrottle (or MaxServerSpeed, or MaxServerBandwidth, etc) and
MaxConnThrottle (or MaxConnSpeed, MaxConnBandwidth, etc) to the server
scope (cherokee_server_t).
- MaxVServerThrottle (or MaxVServerSpeed, etc...) to the virtual server
scope (cherokee_virtual_server_t).
Those parameters must have a precedence order, eg. If MaxServerThrottle
is 128kb/s but the MaxVServerThrottler is 256kb/s we are going to use
the server's value. Below is the correct order:
1 - Server
2 - Connection
3 - Virtual Server
The throttler interface may be the following:
throttler.h/throttler.c
cherokee_throttler_new()
cherokee_throttler_free()
cherokee_throttler_check()
cherokee_throttler_update(bytes_recvd)
To enable the throttler we could create wrapper functions around
cherokee_write, cherokee_read, cherokee_socket_* on connection.c. Eg.
Every time cherokee_write is called, the throttler is checked and if
it's not okay we could return EAGAIN (ret_eagain). Otherwise we do the
write and update the throttler.
I'm sure i'm missing a lot of things, but that should be enough for the
list to start talking about. ;)
Diego Giagio
_______________________________________________
Cherokee mailing list
[email protected]
http://www.alobbs.com/cgi-bin/mailman/listinfo/cherokee