Scenario
- Two servers: ApplicationServer1 and MySQLServer1
- MySQL remote database server is connected to ApplicationServer1 through an SSH tunnel (kept alive using autossh)
The problem
Since I separated the database from the application, the latter slowed down a lot. SSH tunnel is used in the server stack to increase security. Setting up a VPN (such as Tinc) is an alternative, but it seems to slow down much more than the SSH tunnel.
So...
How can I speed up the connection between ApplicationServer1 and MySQLServer1?
Could Redis or Memcached, installed on ApplicationServer1, be a solution?
Thank you all.
By keeping them on the same high-speed network.
I know that's not what you want to hear, but it's the right solution. Application servers should not be separated from their backing servers by more than a millisecond or two at the very top end.
Sure, but any of those solutions will require an extensive re-write of your application, and will really only help with read-only operations. Write operations will still be as slow as you're experiencing now.
I'm not sure what situation transpired to make you separate these two servers, but again, the answer to your question is: move the servers closer together.