This is not a good design


This solution does work in your interview, but this is actually not a good design.
we should definitely store our trie in the memory of our web server, in database, we only store log data, then we will use another service query log db, then update the server recurrently.


Storing trie in webserver is not a good design i think use any in memory distributed data base. your appserver/ webserver will also handle load of incoming and outgoing network data for each query and traversing trie at same time will consume lots of resources