Paul Clapham wrote:Is it possible that on your machine, your code and the database were both running on the same machine? Whereas on your VPS, the database is running on a different machine and the query results have to be sent over the network?
Dave Tolls wrote:Have you got logging in your system (both client and server)?
Do they show you exactly where the delay is in execution?
Dave Tolls wrote:OK, but what is it timing?
Is there enough granularity in the log statements to identify the line (or lines) causing the issue?
Just trying to make sure we aren't looking at the wrong issue here.
Dave Tolls wrote:OK.
Next step.
Can you access the database directly and run the equivalent find query on it?
You should be able to get it to provide stats for the query, rather than just stop watching it (though that would be handy to show if the VPS is slow).
Check both on your local test machine and on the one on the VPS.
Dave Tolls wrote:And if you remove those execution times from the earlier times, how much of a discrepancy is left?
If this accounts for almost all of it, then it's the DB that's the issue for some reason.
If there's still a fair chunk of time difference, then you are probably looking at something to do with the VPS or networking (though by the sounds of it the DB and web app sit on the same VPS).
Guilherme Alan Ritter wrote:
There's a big difference between running the query directly and running it in Spring. So you think the VPS is the culprit? Simply upgrading it should do the trick?
Dave Tolls wrote:
Guilherme Alan Ritter wrote:
There's a big difference between running the query directly and running it in Spring. So you think the VPS is the culprit? Simply upgrading it should do the trick?
Remember, we here are completely detached from what you see.
But if you are getting timings (made up for the sake of example) of something like:
local machine VPS
total time 100 1000
time in db 50 500
then that would imply (to me) that the VPS is simply slower than your local machine.
If those numbers were more like:
local machine VPS
total time 100 1000
time in db 50 850
then that would imply to me that the DB (for whatever reason) was at least pastially responsible.
Note that this is a real "finger in the air" thing, and I would find out exactly what the set up is for your VPS to see whether there is an obvious issue or not before upgrading.
For example, what else shares the VPS hardware.
Consider Paul's rocket mass heater. |