opa: High CPU when Pull Data during Evaluation

I try to Pull Data during Evaluation for my use case which will use http.Send to my server to get external for evaluation.

In test case 1 I have my rego file look like

external_datas := http.send(request).body
allow {
    true
}

My benchmark result is: CCU: 1k Requests/s: 4k CPU: 200% ~ 2 core CPU

In test case 2 just lookup in my external_datas like:

external_datas := http.send(request).body
allow {
    external_data := external_datas[_]
}

My benchmark result is: CCU: 1k Requests/s: 1k(time OPA response high) CPU: 1500% ~ 15 core CPU(my VM hash 16 vCPU)

My external_datas is an array with one item

I don’t why in my test case 2 OPA “eat” a lot of CPU.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (18 by maintainers)

Most upvoted comments

I think my question is resolved. Thank you for your help.