X interview question

How would you implement a rate limiting system?