In my Rails app i have a helper method called “translate”:
tran = Translation.find_by_name(name)
As you can see, the method does a lookup in the table “Translation”,
where i have an index in the field “name”.
This is working well, but in a single page i can have dozens of captions
to translate, and there are several concurrent users, so the whole thing
slows a bit.
I guess preloading the Translation table in a Hashtable would help, but
i wouldn’t load this hash table in each user session: how can i use a
single Hashtable per Server instance ?
Also, with many users i -randomly- have a “MySQL lost connection
error”.I guess finding a solution for the lookup could avoid having this