WasmEdge / wasmedge_hyper_demo

Lightweight HTTP servers based on hyper / warp frameworks in the WasmEdge Runtime.
78 stars 14 forks source link

100% CPU utilization even after request is served[ wasmedge_hyper_server] #11

Open abhisheksharma1395 opened 1 year ago

abhisheksharma1395 commented 1 year ago

Hi,

I am trying to run the docker image of wasmedge_hyper_server in knative. And I observed that even after I got a successful response, the CPU utilization of the pod is 100% until the pod is brought down after some idle time. I tried to replicate the issue with rust only code (without wasm) which appears to be working fine. I was not able to pinpoint the issue. Can anyone please give some input on the same.

image

Best Regards Abhishek Sharma

juntao commented 1 year ago

Thank you. Can you tell us how you setup to run this in knative? Did you use runwasi or crun? Which version of runwasi / crun did you use? Thanks!

cc @dm4

abhisheksharma1395 commented 1 year ago

Hi,

I was running it with crun runtime, and the details are as follows

crun version 1.8.1.0.0.0.16-7be9e commit: 7be9ec2d03e31df0090c062c5bf6ebd241a7cd3b rundir: /run/user/20025/crun spec: 1.0.0 +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +WASM:wasmedge +YAJL

And for additional info, my contained config is [plugins."io.containerd.grpc.v1.cri".containerd.runtimes]

    [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.crun]
      base_runtime_spec = ""
      container_annotations = []
      pod_annotations = ["*.wasm.*", "wasm.*", "module.wasm.image/*", "*.module.wasm.image", "module.wasm.image/variant.*"]
      privileged_without_host_devices = false
      runtime_engine = ""
      runtime_root = ""
      runtime_type = "io.containerd.runc.v2"

      [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.crun.options]
        BinaryName = "crun"
        CriuImagePath = ""
        CriuPath = ""
        CriuWorkPath = ""
        IoGid = 0
        IoUid = 0
        NoNewKeyring = false
        NoPivotRoot = false
        Root = ""
        ShimCgroup = ""
        SystemdCgroup = true

Thanks!

abhisheksharma1395 commented 1 year ago

Hi,

I'd like to point out that with the same knative setup I tried to run https://github.com/second-state/wasmedge_wasi_socket examples, they are working fine (no 100% CPU utilization after the request is served ).

I prematurely suspect there might be some issue with hyper or tokio dependencies.

  1. Based on previous observation, with rust code (with and without wasm) we can rule out issues with main.rs.
  2. Based on this observation, we can rule out issues with environment (knative and runtime) setup.

Thanks