Rasa core memorization policy is very slow when it "launches DeLorean"

Everytime I send a message to the bot, it stucks for a long time when it prints

DEBUG rasa_core.policies.memoization - Launch DeLorean…

, maybe around a minute or more. I am already using a small max_history.

This is my policy:


  • name: KerasPolicy epochs: 100 max_history: 5
  • name: AugmentedMemoizationPolicy max_history: 2
  • name: FormPolicy
  • name: MappingPolicy

And my log:

2019-06-17 22:13:18 DEBUG rasa_core.processor - Action ‘utter_introduce’ ended with events ‘[]’

2019-06-17 22:13:18 DEBUG rasa_core.processor - Bot utterance >‘BotUttered(text: hello, data: { “elements”: null, “buttons”: null, “attachment”: null })’

2019-06-17 22:13:19 DEBUG rasa_core.policies.memoization - Current tracker state [{‘slot_ex_0’: 1.0, ‘slot_utterance_id_0’: 1.0, ‘slot_respondent_0’: 1.0, ‘entity_epic_id’: 1.0, ‘entity_utterance_id’: 1.0, ‘slot_enquirer_0’: 1.0, ‘slot_epic_id_0’: 1.0, ‘prev_action_listen’: 1.0, ‘intent_greet’: 1.0, ‘slot_mc_answer_1’: 1.0}, {‘slot_ex_0’: 1.0, ‘slot_utterance_id_0’: 1.0, ‘slot_respondent_0’: 1.0, ‘entity_epic_id’: 1.0, ‘entity_utterance_id’: 1.0, ‘slot_enquirer_0’: 1.0, ‘slot_epic_id_0’: 1.0, ‘intent_greet’: 1.0, ‘slot_mc_answer_1’: 1.0, ‘prev_utter_introduce’: 1.0}]

2019-06-17 22:13:19 DEBUG rasa_core.policies.memoization - Launch DeLorean…

Do you know what makes it so slow and how to make it faster?

Problems solved. It is my mistake.

It is because I have not specified max_event_history when I define my custom tracker store.

So, when I ahve more then 10k records, the McFly update function iterates through all of them.

After I set max_event_history to 100, the memorization policy is much faster.

The thread below shows how to limit the tracker history size:

I’ve faced same issue. Is it possible to set max_event_history with mongo or sql tracker?

Did found this issue recently and clients started complaining.

I did dig deep into the code and able to solve by writing custom TrackerStore,

class MyCustomRedisTrackerStore(RedisTrackerStore):

read the existing events and delete the old events and save them back to the store. Hope this helps you too.

this can be done to any TrackerStore