Add Phase 2 optimizations: status API caching and improved Redis pipelining

- Add in-memory cache for /status endpoint with 30s TTL
- Cache keyed by view parameters to handle different query patterns
- Add cache clearing for tests to prevent interference
- Optimize get_queue_metrics to use single pipeline for all Redis calls
  - Previously made 7+ separate pipeline calls
  - Now combines all queue metrics into one pipeline (7n+2 operations)
  - Reduces Redis round trips and improves API response time
- Update unit tests to match new pipelining behavior
- All 866 tests passing
This commit is contained in:
Mahima Singh 2025-12-24 12:25:14 +05:30
parent e5c0fa986e
commit 7b657edd0d
4 changed files with 86 additions and 15 deletions

View file

@ -17,6 +17,8 @@ describe Vmpooler::API::V3 do
# https://rubydoc.info/gems/sinatra/Sinatra/Base#reset!-class_method
before(:each) do
app.reset!
# Clear status cache to prevent test interference
Vmpooler::API::V3.clear_status_cache
end
describe 'status and metrics endpoints' do