CacheControl / CacheControl/json-rules-engine

Rule Evaluation taking around 10,000-15,000 ms for around 10k rules.

Aberta
#364 4 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
JavaScript
Estrelas
3.1k
Forks
507
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Direção de pesquisa

Nenhum arquivo do repositório, teste ou ponto de entrada foi indicado. Comece reproduzindo a avaliação relatada com o formato de regra fornecido e aproximadamente 10 mil regras; em seguida, faça o profiling do caminho de avaliação e documente a operação limitante; concluído significa uma causa medida e uma melhoria de desempenho validada.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
javascript
Domínio
backend, performance
Tipo de issue
Bug
Dificuldade
5/5
Tempo estimado
Mais de uma semana
Status de atividade
Estagnada
Clareza
Precisa de esclarecimento
Facilidade para iniciantes
25/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.