Performance issue with Rasa

I am facing the same with Rasa 1.4.3 version.

My normal pre defined actions like “utter_greet” etc are getting replied quickly. But its taking approx 2-3 seconds when a custom action is called.

It has nothing to do with the content of the .For me even a small custom action like this- class ActionCheckContract(Action): def name(self): return “contract_action”

def run(self, dispatcher, tracker, domain):
    intent = tracker.latest_message["intent"].get("name")
    if intent == "inform_contract_owner":
        dispatcher.utter_template("utter_change_mind", tracker)
        return []

**Takes the equal amount of time to response in compared to this (5% of Actions,py) class ActionCheckContract(Action): def name(self): return “contract_action”

def run(self, dispatcher, tracker, domain):
    client = pymongo.MongoClient("localhost", 27017)
    db = client.in_dev
    collection = db.Contract
    entity = tracker.get_latest_entity_values("contract_name")
    entity_DB = next((j for j in collection.find({"_id": ObjectId(entity)})), None)
    intent = tracker.latest_message["intent"].get("name")
    intents_check_dict = {"inform_contract_owner": 'contractOwner', "inform_contract_number": "contractNumber",
                          "inform_contract_risk_rating": "contractRisk",
                          "inform_contract_annual_spend": "annualSpend",
                          "inform_business_risk_rating": "riskRating", "inform_contract_value": "value",
                          "inform_contract_renewal_period": "renewalPeriodId",
                          "inform_contract_liquidation_damages": "liquidationDamage",
                          "inform_contract_minimum_spend": "minimumSpend",
                          "inform_contract_addressable_spend": "addressableSpend",
                          "inform_contract_policy_number": "policyNumber"}

    def intent_lookup(intent):
        return intents_check_dict.get(intent)

    c = intent_lookup(intent)
    if c is not None:
        return []

It takes the same time ,even if I alter the interface file to change a function and get my entity through text search API locally. So could u please suggest a solution to this? How much time it generally takes for rasa bots to get response from custom actions.??

seems like there might be a latency issue introduced by the network. Are you running the action server and the bot on the same machine ? What is in your endpoints.yml?

Yes both the servers are running locally one one system. By the way, what do you exactly mean by latency by"network" which network are we speaking off??

And my endpoints. Yml consist of Only action endpoint url

if you are running everything locally then it’s unlikely network latency is involved.

is the action server also slow if you send a request via curl, or only if the request comes from Rasa?

@amn41 I tested on Postman and there was no lag. The response from action server wasnt delayed. It seems issue arrises when call is being made from core.actions.action -

rasa.core.actions.action - Calling action endpoint to run action “action_name” (DEBUG)

@amn41 So what might be the reason that call to the action server ,only from rasa is delayed and not Postman. ??? Where exactly I should look to resolve the lag.?

it’s hard to guess what could be happening. If you update to a more recent version (e.g. 1.6) does the problem persist?

Yes, actually I tried it with the latest rasa 1.6.1 version too. Same results

ok. I’m starting to think this is a bug. Could you please create an issue on the repo, and include a minimal bot to reproduce this issue? Can be a domain with just two actions (one utter_greet and one custom).

@amn41 Okay! I will be creating the issue on git. Repo.

I am still facing this issue. I am using rasa 1.10.1. Any update on this?

I don’t see this behaviour in Rasa 1.10.12, at least not when using the shell

@mohangunta Sorry for the late response. This actually has to do with Older windows processors. In the endpoints.yml you need to replace the localhost with and response time shall be normal thereafter.

action_endpoint: url: “

Hope it helps.