X Interview Question

How would you implement a rate limiting system?