Bug: Missing caching on career pathway queries causes slow response times and database overload
Problem Statement
DevPath does not implement caching for career pathway data, causing redundant database queries on every user request. This leads to slow response times, high database load, and poor user experience especially for popular career paths requested frequently.
Root Cause Analysis
Career data queries hit database every request without caching layer. No Redis or in-memory cache. No cache invalidation strategy. Database queries not optimized with indexes. No pagination on large result sets.
Solution Overview
- Implement Redis caching for career pathway data
- Set appropriate TTL (time-to-live) based on update frequency (3600s for hourly updates)
- Implement cache invalidation on data updates
- Add database query optimization with indexes
- Implement pagination for large datasets
- Add cache warming on application startup
- Monitor cache hit/miss rates
- Use compression for large cached objects
Type of Change
- [x] Bug fix (performance)
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
Testing Done
Environment
- Node.js 18.x+
- Redis
- Database with indexes
Manual Testing Steps
Test Case 1: Response time without cache
- Request career pathway data
- Measure response time
Expected: Response time < 100ms with cache Actual: Response time 1000ms+ hitting database every time
Related Issue
Improves application performance and reduces database load.
Suggested Labels
bug, level:intermediate, gssoc26, performance, caching, database-optimization
Hey @komalharshita , this is my proposed solution,
- Add a Redis middleware in your API route handler (e.g., routes/careers.js) to check cache before querying, and update db/queries.js to add indexes and pagination parameters.
- On data mutations in controllers/careerController.js, call redis.del(cacheKey) to invalidate stale cache, and add a scripts/warmCache.js startup script that pre-loads popular career paths into Redis on app boot.
Can you assign this to me Under gssoc26, thank you for your time.
/assign
/assign
I'd like to work on this — contributing under GSSoC'26
/assign
/assign gssoc'26
/claim Hi @komalharshita ,
I would love to take ownership of this performance optimization issue under GSSoC '26.
I understand that caching and query optimization are critical for scaling the application. Here is my comprehensive plan to implement the solution outlined in the issue description:
Proposed Technical Approach:
- Caching Layer (Redis):
- Integrate a Redis client and create a caching middleware for the career pathway
GETroutes. - Implement a 3600s TTL for the cached data and use payload compression (e.g., Brotli or Gzip) for large JSON responses to optimize memory.
- Integrate a Redis client and create a caching middleware for the career pathway
- Cache Management:
- Implement cache invalidation hooks in the respective
POST/PUT/DELETEcontrollers to clear stale data automatically. - Create a lightweight
warmCache.jsutility that runs on application startup to preload the top 10-20 most requested career pathways.
- Implement cache invalidation hooks in the respective
- Database Optimization:
- Update the database schema/migrations to add indexes to the most frequently queried fields (e.g., pathway names, categories).
- Implement standard
limitandoffset(or cursor-based) pagination on the backend and ensure the frontend handles the paginated responses properly.
I am comfortable working with Node.js, Redis, and database indexing. Please let me know if you have a preferred Redis hosting setup for local testing (e.g., Docker). I would be thrilled if you could assign this to me!
Hi @komalharshita, I'd like to work on this. Plan: add an in-process TTL cache (or Redis-backed cache if the project already has a Redis dependency) keyed by pathway/user parameters in front of the career pathway query path, with explicit invalidation on any write to pathway data, and a benchmark showing query count/latency before vs. after. Requesting assignment under GSSoC 2026.
/assign /claim
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!
This issue was closed because it has been inactive for an extended period. If this issue is still relevant, feel free to reopen it or create a new one.