ok zero sounds good. I thought maybe it could be a good idea to go negative in case the user sends too many requests, since we still respond to those. ofc the response does not include any "heavy computation"
I think the below part:
For this step, implement this strategy such that the bucket is per IP address, has a capacity of 10 tokens with new tokens added at a rate of 1 token per second.
then when you mention testing with virtual users through postman. I did test it with virtual users, and it does not send requests from different ip addresses. so if you implement rate limiter to basically create a bucket per ip address then simulate with postman say 10 virtual users... you will have just one bucket
correct but the article that you point to ( about postman virtual user setup/ testing) does not include instructions on that level. Also this exercise is just for getting better at coding and not worrying about stuff like that.
Anyway I just wanted to add my two cents. I implemented my rate limiting based on an endpoint like this: GET /<username>/limited - where a bucket is created per username. way simpler setup in terms of testing it.
thanks for your work! I love these coding challenges!
why is it that when I use postman with 10 virtual users, all the requests are sent from the same ip_address as the source (i.e. localhost address)
edit: okay it turns out postman does not simulate virtual users with different ip addresses. so i think the description should be changed.
Also do you think it is a good idea to let the bucket have negative tokens inside it? or do you have minimum at zero?
Which description do you think is wrong?
The minimum is zero.
ok zero sounds good. I thought maybe it could be a good idea to go negative in case the user sends too many requests, since we still respond to those. ofc the response does not include any "heavy computation"
I think the below part:
For this step, implement this strategy such that the bucket is per IP address, has a capacity of 10 tokens with new tokens added at a rate of 1 token per second.
then when you mention testing with virtual users through postman. I did test it with virtual users, and it does not send requests from different ip addresses. so if you implement rate limiter to basically create a bucket per ip address then simulate with postman say 10 virtual users... you will have just one bucket
Yes you will have just one IP address if you run postman just from one machine, which is fine.
You could also test from multiple machines or VMs with different IP addresses if you have a suitable test setup.
correct but the article that you point to ( about postman virtual user setup/ testing) does not include instructions on that level. Also this exercise is just for getting better at coding and not worrying about stuff like that.
Anyway I just wanted to add my two cents. I implemented my rate limiting based on an endpoint like this: GET /<username>/limited - where a bucket is created per username. way simpler setup in terms of testing it.
thanks for your work! I love these coding challenges!