Eric S. Johansson wrote:
>> 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.
>>
> ...
>
>> What do you think of it? It is just an idea :-)
>>
>
> makes a great deal of sense. It does run the risk of significantly
> slowing down the performance of Cherokee when there are no throttle
> predicates.
We can use something like:
if (server->throttler.is_active) {
ret = cherokee_throttler_client_has_room (&vserver->throttler);
if (ret != ret_ok) {
sent_connection_to_sleep();
}
}
In this way, we only spend a few bytes more in each server, virtual
server, or directory_entry structure, that is all. The critical path
remains the same with three new and insignificant "if"s.
> are there different sets of predicates at each chokepoint?
No, there is only one per checkpoint:
- Server: it check the server limit: Eg. 100Kb/s
- Virtual Server: idem for the vserver: Eg. 33Kb/s
- Resource: Eg. Directory /mp3: Eg. 20Kb/s
It should check each case independently. For example, in the case of
the global server check, it has to check if the server allows it to
send information (and maybe how much?) and that is all, only single
check.
After the three checks, it has to be either sleeping or ready to
process the connection. It goes top-down, so to be allowed to send
information to the client there has to be room in the server, the
virtual server, and the specific resource. If any of those reached
the bandwidth limit, it will just send the connection to sleep.
> are the predicates chained by a full set of logical operations?
Ummm.. no in my example. IMO, it isn't needed. As soon as any for
the check points forbid the connection to continue, it will be moved
to sleep for a while (some ms), so the logical thread will be cut
off at that point.
Does this scheme make sense for you? Ideas? :-)
--
Greetings, alo.
_______________________________________________
Cherokee mailing list
[email protected]
http://www.alobbs.com/cgi-bin/mailman/listinfo/cherokee