An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
Hey @ramprasad.r !
It looks like you're encountering some common behavior with Azure Function Services deployed on AKS, particularly around memory usage and pod restarts. Let’s unpack your questions and concerns.
Expected Memory Growth
- Gradual Memory Growth: It's generally expected that memory usage can gradually increase over time when processing events from Azure Service Bus and Event Hub. As functions process more messages, they might consume more memory. This is typical if there's no memory leak, but continuous or unusual memory growth could indicate a problem.
Memory Limits
- Memory Limits of 2 Gi: A memory limit of 2 Gi can indeed serve as a baseline for many workloads. However, the appropriate limit really depends on the specific memory requirements of your function. If you're consistently hitting that limit, you might want to increase it based on the actual usage patterns you observe with
kubectl top pod.
Pod Restarts: It's acceptable in Kubernetes for pods to restart due to exceeding memory limits (OOMKilled). The main concern is whether the restarts impact functionality. If your functions are resuming normal operations post-restart without issues, this behavior can be considered manageable.
Best Practices and Guidance
Microsoft does provide best practices for memory sizing and capacity planning for Azure Function Services on AKS. You may want to consider using tools like the Vertical Pod Autoscaler to help optimize resource requests based on actual usage. Additionally, implementing Pod Disruption Budgets can help minimize impact during pod restarts and upgrades.
Recommendations:
- Monitor Memory Usage: Use
kubectl top pod <pod-name>andkubectl describe pod <pod-name>to monitor memory usage and diagnose restarts. - Consider Increasing Limits: If you observe high memory consumption, consider increasing the memory limit for your function pods.
- Implement Autoscaling: Look into setting up Horizontal Pod Autoscaler and Vertical Pod Autoscaler to ensure your service scales appropriately based on real-time demand.
- Review Logs: Check application logs for any memory leaks or performance issues leading to high memory consumption.
I hope this all helps clarify things! If you have more questions, feel free to ask!
References: