2 ms·
FIFO queues do not fix overload. Fair queuing queues, though, can fix it if the problem is coming from a specific source. I have a web site set up that way. An
by Animats 3y ago
FIFO queues do not fix overload. Fair queuing queues, though, can fix it if the problem is coming from a specific source.
I have a web site set up that way. An in-memory table in MySQL is used to handle queuing for a slow operation. The queuing system has some fairness. This works well enough that one site sent bogus requests for a month at a high rate, and it had no effect on actual users.
Fair queuing in SQL:
SELECT domain, requestor_ip_hash, rating_state_int, base_domain FROM ratingqueue AS rqueue
WHERE (rating_state_int = 3 OR rating_state_int = 4)
AND NOT EXISTS(SELECT * FROM ratingqueue
WHERE base_domain = rqueue.base_domain
AND (rating_state_int = 1 OR rating_state_int = 2))
ORDER BY rating_state_int, request_timestamp
LIMIT 1;
- tanveergill 3y agoI agree that fair queueing is a good solution to this problem! A request scheduler based on weighted fair queuing is also central to Aperture, an open-source load management system my team has been building for the last 2 years. Priorities and tokens (request weights) can be provided to Aperture when scheduling requests. It runs weighted fair queuing that ensures relative allocation of capacity based on the relative values of (token/priorities). It also ensures fair allocation of capacity across users within the same priority class so that no single user can starve others. Would love to hear your thoughts about this project: https://github.com/fluxninja/aperture https://github.com/fluxninja/aperture