AI

Create Alerts for Milvus Services

Milvus is a high-performance, distributed, open-source vector database for large-scale machine learning and artificial intelligence (AI) applications.

It leverages the cutting-edge indexing and search techniques to efficiently store, retrieve, and process a vast amount of multi-dimensional data, particularly the vectors. Milvus supports similarity search, similarity join, and other advanced operations that enable the users to handle the complex data analysis tasks effectively.

Milvus provides a comprehensive set of APIs and SDKs in multiple programming languages which allows us to integrate it seamlessly into AI workflows.

It also has various data types including integers, floating-point numbers, and binary vectors which ensure the versatility in accommodating a diverse application scenarios.

Grafana, on the other hand, is a sophisticated and feature-rich open-source data visualization and analytics platform that is designed to facilitate a real-time monitoring, analysis, and exploration of complex time-series data.

This tutorial will teach you how to use Grafana to create alerts. This allows you to receive notifications when the value of a specific metric exceeds a defined threshold.

Requirements:

This tutorial assumes that you have the following:

  1. Installed Kubernetes Engine
  2. A Milvus cluster that is deployed on Kubernetes

Deploying Grafana and Prometheus

To get the metrics from the Milvus cluster, we need Prometheus which can interact with the Kubernetes pods and gather the metric information. Grafana allows us to visualize the metrics from Prometheus, create data visualization, and create alerts.

If you wish to learn how Prometheus interacts with the Milvus cluster and how it gathers the metrics, you can check the following link:

https://milvus.io/docs/monitor.md

To save us the trouble of manually using Prometheus and Grafana, Milvus uses the kube-Prometheus which provides us with the manifest to deploy Prometheus and Grafana quickly.

https://github.com/prometheus-operator/kube-prometheus

You can run the commands as provided in the following to quickly deploy it:

git clone https://github.com/prometheus-operator/kube-prometheus.git

cd kube-prometheus

Run the manifest:

kubectl apply --server-side -f manifests/setup

kubectl wait \
--for condition=Established \
--all CustomResourceDefinition \
--namespace=monitoring

kubectl apply -f manifests/

Once everything is setup, you can access the dashboards for both Grafana and Prometheus using the commands:

For Prometheus:

$ kubectl --namespace monitoring --address 0.0.0.0 port-forward svc/prometheus-k8s 9090

For Grafana:

kubectl --namespace monitoring --address 0.0.0.0 port-forward svc/grafana 3000

You can then enable the monitoring on your Milvus cluster:

helm upgrade my-release milvus/milvus --set metrics.serviceMonitor.enabled=true --reuse-values

Once completed, check the service monitor.

kubectl get servicemonitor

Creating Alerts

To add an alert for the memory usage of Milvus components, edit the Memory panel in Grafana and add a new query with the metric:

process_resident_memory_bytes{app_kubernetes_io_name="milvus", app_kubernetes_io_instance=~"my-release", namespace="default"

Save the dashboard and wait a few minutes to see the alert.

Conclusion

This explores the basics of setting up the notifications for various resources in the Milvus cluster using Prometheus and Grafana. Check the docs for more info.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list