Diego Giagio wrote:
>> Tomorrow I will try to test the patch. I will let you know :-)
>
> Did you have a chance to test the patch ? Did anyone else test ? I
> just want to know whether we are going on the right direction ;)
I have been thinking about the current code and the current
structure..
Now, the throttler is connection based, but we have to support
connections, resources and the server, so I would suggest to change
it structure a little bit in order to make it more generic.
This is the scheme in my mind. Tell me what you think of it :)
Server
|
+--------|--------+
throttler ------+ | |
client | |
[Virtual Server] [Thread]
throttler ------+ | |
client | |
[Resources] [Connections]
throttler ------+
client
Each throttler client stores the information of its context. If we
make it generic enough it ought to work in the resource, the virtual
server and the server.
This object can store the information about the limit, and the
information about the current traffic, timing and so on.
In this way, in each cherokee_server_step() call it should do
something like:
for each active connection {
ret = cherokee_throttler_client_has_room (&server->throttler);
if (ret != ret_ok) {
/* The bandwidth limit has been reached
*/
sent_connection_to_sleep();
}
[..]
/* When the virtual server has been asigned
*/
ret = cherokee_throttler_client_has_room (&vserver->throttler);
if (ret != ret_ok) {
sent_connection_to_sleep();
}
/* If the connection is here, there was available bandwidth in
* the virtual host, so let's take a look at the resource..
*/
ret = cherokee_throttler_client_has_room (&entry->throttler);
if (ret != ret_ok) {
sent_connection_to_sleep();
}
/* Attend the connection, there weren't any applicable bandwidth
* restriction.
*/
}
What do you think of it? It is just an idea :-)
--
Greetings, alo.
_______________________________________________
Cherokee mailing list
[email protected]
http://www.alobbs.com/cgi-bin/mailman/listinfo/cherokee