CacheControl / CacheControl/json-rules-engine
Rule Evaluation taking around 10,000-15,000 ms for around 10k rules.
- 主要語言
- JavaScript
- 星號
- 3.1k
- 分支
- 507
- PR 合併指標
- 30 天內沒有已合併 PR
描述
hi @CacheControl , We are using json-rule-engine in our project to get outcome by evaluating around 10k records stored in mongodb.
I am sharing one rule for your reference. We have 10k record like this in our project and evaluating it against facts takes around 10-15 seconds.
`{
"conditions": {
"all": [
{
"fact": "customer_delivery_address",
"operator": "equal",
"factLabel": "Customer Delivery Address",
"value": "GB",
"valueSet": [
{
"value": "GB",
"label": "GB"
}
]
},
{
"fact": "customer_tier",
"operator": "equal",
"factLabel": "Customer Tier",
"value": "gold",
"valueSet": [
{
"value": "gold",
"label": "Gold"
}
]
},
{
"fact": "new_customer",
"operator": "isBoolean",
"factLabel": "New Customer",
"value": true,
"valueSet": [
{
"value": true,
"label": true
}
]
},
{
"fact": "order_amount",
"operator": "greaterThan",
"factLabel": "Order Amount",
"value": 2500,
"valueSet": [
{
"value": 2500,
"label": "2500"
}
]
},
{
"fact": "order_count",
"operator": "lessThan",
"factLabel": "Order Count",
"value": 100,
"valueSet": [
{
"value": 100,
"label": "100"
}
]
},
{
"fact": "order_date",
"operator": "isDateGreaterThan",
"factLabel": "Order Date",
"value": "2024-02-01T05:15:44Z",
"valueSet": [
{
"value": "2024-02-01T05:15:44Z",
"label": "2024-02-01T05:15:44Z"
}
]
},
{
"fact": "order_date",
"operator": "isDateLessThan",
"factLabel": "Order Date",
"value": "2024-03-01T05:10:50Z",
"valueSet": [
{
"value": "2024-03-01T05:10:50Z",
"label": "2024-03-01T05:10:50Z"
}
]
},
{
"fact": "order_state",
"operator": "equal",
"factLabel": "Order State",
"value": "confirmed",
"valueSet": [
{
"value": "confirmed",
"label": "Confirmed"
}
]
},
{
"fact": "payment_state",
"operator": "equal",
"factLabel": "Payment State",
"value": "paid",
"valueSet": [
{
"value": "paid",
"label": "Paid"
}
]
},
{
"fact": "customers",
"operator": "equal",
"factLabel": "Customers",
"value": "sample@gmail.com",
"valueSet": [
{
"value": "sample@gmail.com",
"label": "sample@gmail.com"
}
]
}
]
},
"event": {
"type": "categories",
"params": {
"label": "Category",
"value": "Fitness Kit",
"key": "8173dfd1-d8a1-417d-ab78-07dfa6799f59",
"operator": "is",
"source": "resource"
}
}
}`
Can you please help me understand why it is taking so much time to evaluate this type of rule. If possible please share solutions for improving performance also.
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
未指定任何儲存庫檔案、測試或進入點。首先使用提供的規則形狀和約 10k 條規則重現回報的評估過程,然後對評估路徑進行效能分析並記錄限制性操作;完成的標準是找到經測量的原因並驗證效能改善。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript
- 領域
- backend, performance
- Issue 類型
- 缺陷
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100