How to reduce latency

Hi, I have a serious latency issue, when I click the button the action takes 10-20 seconds to execute.
is it possible to have a tiny local database to reduce this latency?