Bot respond very slow/performance issue/lag?

My rasa core is 0.11.12 and NLU is 0.13.7. We tested at home (dynamic IP) with opened 15+ tabs connected to the bot server and interacted at the same time. We did not encounter any latency issue.

However, recently I have around 10-20 people connected to my bot at the same time. The server was on windows 10 home 64bit(CPU i7 8550, 256SSD) using chatroom. The server was connected internet using a real ethernet cable with a static IP address at my office. But the bot replied very slow. The users needed to wait 30-60sec in order to get a reply. Even worse, sometimes it went to fallback action after a long wait. Then, I tried to split half users to another server using MacAir 2018 with i5 cpu. The users got a bit faster reply from the bot when they connected to the MacAir server though.

I have 5 slots that will store in a txt file using user ID in my, here I provide part of the code (I am not sure if it’s the reason caused the delay). However, even just a normal conversation, the users needed wait for a long time.

class ActionLogsave(Action):

    def name(self):
        return 'action_logsave'

    def run(self, dispatcher, tracker, domain):
        events_log = (tracker.current_state())["events"]
        indexFile_senderid = open('./user_logs/' + str(tracker.get_slot("slot_agree")) + '.txt', 'a+', encoding='utf-8')
        indexFile_senderid.write('This is the final log: ' + str('\n\n') + 'events: ' + str(events_log) + str('\n\n'))

Does anyone know how to solve this issue?

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.

Could you please tell me how you managed to do so?

Did you solve this?