guardian
guardian copied to clipboard
Optimize Memory Usage for Policies
Problem Description
Currently, each policy consumes approximately 160 MB of memory. The policy service, which executes each policy in a separate thread, is the most memory-intensive service in our system. This excessive memory consumption limits scalability and increases infrastructure costs. Optimizing memory usage is critical to improving system efficiency and reducing operational expenses.
Requirements
- Analyze the memory usage of individual policies to identify optimization opportunities.
- Reduce the per-policy memory footprint while maintaining functionality.
- Optimize the policy execution model to use resources more efficiently.
- Evaluate and, if needed, implement alternative execution strategies (e.g., thread pooling, lazy loading, or policy instance reuse).
- Ensure that optimizations do not degrade system performance or introduce concurrency issues.
Definition of Done
- [ ] The memory consumption of a single policy is significantly reduced compared to the current 160 MB baseline.
- [ ] The overall memory footprint of the policy service is reduced without negatively impacting throughput or execution speed.
- [ ] No regressions in existing policy execution behavior.
Acceptance Criteria
- A single policy instance consumes significantly less than 160 MB of memory.
- The policy service’s total memory footprint is noticeably reduced.
- Tests confirm that execution time and throughput are not negatively affected.