-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Figure out Rate Limiting for Datasets on MySQL #55481
Comments
We're using encrypted cookies for sessions storage, so it should be fast/performant to keep rate counters per-user if that's the approach we want to follow. |
Firebase is doing async calls and using a websocket to be able to achieve the throughput. It doesn't have to do a roundtrip per transaction. We're investigating how we would deal with auto incrementing the record_id part of the composite primary key without locking the entire table. Here's a working guess on a query to use: BEGIN;
SELECT @id := IFNULL(MAX(record_id),0) + 1 FROM unfirebase.records WHERE channel_id='shared' AND table_name='words' FOR UPDATE;
INSERT INTO unfirebase.records
VALUES
('shared', 'words', @id, '{}');
COMMIT;
SELECT * FROM unfirebase.records WHERE channel_id='shared' AND table_name='words' and record_id > 4983; todo: update the quary when we figure out a better one # set profiling=1;
BEGIN;
SELECT MAX(record_id) FROM unfirebase.records WHERE channel_id='shared' AND table_name='Rabbits' FOR UPDATE;
SELECT @id := IFNULL(MAX(record_id),0)+1 FROM unfirebase.records WHERE channel_id='shared' AND table_name='Rabbits';
DO SLEEP(10);
INSERT INTO unfirebase.records
VALUES
('shared', 'Rabbits', @id, '{}');
COMMIT;
# show profiles;
# SELECT * FROM unfirebase.records WHERE channel_id='shared' AND table_name='Rabbits'; |
See: #55554 (comment) for followup to the above (implementing manual auto increment) |
Current impl is client side rate limiting Want to rate limit on blocks only (not in the UI) |
* Implement rate limiting for datablock storage at the block level. * Fixes #55481 --------- Co-authored-by: Cassi Brenci <cassi.brenci@code.org>
Rate Limiting
In Firebase we maintain a rate limit per project/channel, 300 writes per 15 seconds, 600 writes per 60 seconds.
The text was updated successfully, but these errors were encountered: