Skip to content

feat: support prisdb kvcache data plane metrics #1158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/orchestration/v1alpha1/kvcache_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ type KVCacheSpec struct {
// cache's service
// +kubebuilder:validation:Optional
Service ServiceSpec `json:"service,omitempty"`

// kvcache hpkv monitor agent for member registration
// +kubebuilder:validation:Optional
HpkvMonitorAgent *RuntimeSpec `json:"hpkvmonitoragent,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of forgot we plan to use a separate pod or just a sidecar of kvcache watcher role?
If we plan to use sidecar, we do not necessarily need to introduce the api change here?

}

// KVCacheStatus defines the observed state of KVCache
Expand Down
26 changes: 25 additions & 1 deletion pkg/controller/kvcache/backends/hpkv.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func buildCacheStatefulSet(kvCache *orchestrationv1alpha1.KVCache) *appsv1.State

annotations := map[string]string{
"prometheus.io/scrape": "true",
"prometheus.io/port": strconv.Itoa(params.AdminPort),
"prometheus.io/port": strconv.Itoa(2112),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we extract default values ​​instead of hard-coding them? 🤔

"prometheus.io/path": "/metrics",
}
rdmaKey := corev1.ResourceName("vke.volcengine.com/rdma")
Expand All @@ -284,6 +284,8 @@ func buildCacheStatefulSet(kvCache *orchestrationv1alpha1.KVCache) *appsv1.State
"-v", "$AIBRIX_KVCACHE_BLOCK_SIZE_IN_BYTES",
"-b", "$AIBRIX_KVCACHE_BLOCK_COUNT",
"--acl", "any",
"-A", "$AIBRIX_KVCACHE_RDMA_IP",
"-P", "$AIBRIX_KVCACHE_ADMIN_PORT",
}
kvCacheServerArgsStr := strings.Join(kvCacheServerArgs, " ")
privileged := false // let's use fine-grained permission
Expand Down Expand Up @@ -358,6 +360,28 @@ func buildCacheStatefulSet(kvCache *orchestrationv1alpha1.KVCache) *appsv1.State
},
},
},
{
Name: "kvcache-hpkv-monitor-agent",
Image: kvCache.Spec.HpkvMonitorAgent.Image,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use override mode for this setup. Let me share one example with you.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you check this example? https://github.com/vllm-project/aibrix/blob/main/samples/kvcache/infinistore/kvcache_customized.yaml#L42-L89

in this case, you do not need api level change, you can bake the agent container directly.

ImagePullPolicy: corev1.PullPolicy(kvCache.Spec.HpkvMonitorAgent.ImagePullPolicy),
Command: []string{
"/bin/bash",
"-c",
`
RDMA_IP=$(ip addr show dev eth1 | grep 'inet ' | awk '{print $2}' | awk -F/ '{print $1}')
echo "Using RDMA IP: $RDMA_IP"
./monitor_agent --hpkvAddr=$RDMA_IP
`,
},
Ports: []corev1.ContainerPort{
{
Name: "hpkv",
ContainerPort: int32(2112),
Protocol: corev1.ProtocolTCP,
},
},
Resources: kvCache.Spec.HpkvMonitorAgent.Resources,
},
},
Volumes: []corev1.Volume{
{
Expand Down