How do I find why a python scripts runs in significantly different running times on different machines?
The Facts:
- I am working on a NoteBook with Intel Core 2 Duo 2,26 GHz and 4 Gigabyte of Ram. It has a Apache Server and a MySQL Server running.
- My Server (I did
lshw | less
) shows a 64 Bit CPU with 2,65 GHz and 4 Gigabyte Ram, too. It has the XAMPP-Package running on it. - The Database structures (tables, indices, ...) are identical and so is the Python scrip开发者_JAVA技巧t I am running.
The Problem:
While the script runs in approximately 30 seconds on my macbook it took the script 11 minutes on the server!
What are the points you would check first for a bottleneck?
The Solution:
There were two indices missing on one of the machines. I added them and voilá: Everything was super! The `EXPLAIN' keyword of MySQL was worth a mint. =)
What kind of server? If you're renting a VPS or similar you're contending with other users for CPU time.
What platform is running on both? Tell us more about your situation!
I would check that the databases in question are of similar scope. You say they're the same structure, but are they sized similarly? If your test case only has 100 entries when production has 100000000, that's one huge potential area for performance problems.
精彩评论