Skip to content

Latest commit

 

History

History
42 lines (27 loc) · 1.03 KB

README.md

File metadata and controls

42 lines (27 loc) · 1.03 KB

Request Window Monitor

A Java project that tracks how many requests were received within a recent time window.

Why I Built This

This project was built to practice queues and understand how systems monitor recent activity without storing old, unnecessary data.

How It Works

The program stores request timestamps in a queue.

When a new request arrives:

  1. Add the timestamp to the queue.
  2. Remove requests that are outside the time window.
  3. Return the number of requests currently inside the window.

Technologies Used

  • Java
  • Queue
  • LinkedList

Concepts Practiced

  • Queue Data Structure
  • Sliding Window Technique
  • Time-Based Processing

Sample Output

Request at 1 ms    -> 1 request(s) in window
Request at 100 ms  -> 2 request(s) in window
Request at 3001 ms -> 3 request(s) in window
Request at 3002 ms -> 3 request(s) in window

What I Learned

How to use a queue and sliding window approach to efficiently track recent events, a technique commonly used in rate limiting and traffic monitoring systems.