Alvaro Lopez Ortega wrote:
Eric S. Johansson wrote: > 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.
makes sense. And if you are trying to throttle your output stream, it's OK for the evaluation process itself to limit performance.
> 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.
briefly thinking about the kind of attributes one would want to measure in order to limit requests, I can think of bandwidth, connection rate and CPU load. while these have value solo, they also have value when combined. for example, if my five-minute load average exceeds 1.6, I want to limit my connection rate to no more than five per second. If my connection rate exceeds 300 requests per second, limit the overall outgoing bandwidth to 1.5 kb per second.
just an idea.
Does this scheme make sense for you? Ideas? :-)
in general yes. Any control is good control as long as it's clear and simple enough to use.
--- eric _______________________________________________ Cherokee mailing list [email protected] http://www.alobbs.com/cgi-bin/mailman/listinfo/cherokee
