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 script I am running.
我正在使用Intel Core 2 Duo 2,26 GHz和4 GB Ram的笔记本电脑。它运行Apache服务器和MySQL服务器。
我的服务器(我做了lshw | less)显示了64位CPU,2,65 GHz和4 GB Ram。它上面运行着XAMPP-Package。
数据库结构(表,索引,...)是相同的,我正在运行的Python脚本也是如此。
The Problem:
While the script runs in approximately 30 seconds on my macbook it took the script 11 minutes on the server!
虽然脚本在我的macbook上运行大约30秒,但它在服务器上花了11分钟!
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. =)
其中一台机器上缺少两个索引。我添加了它们并且瞧瞧:一切都超级棒! MySQL的`EXPLAIN'关键字值得一试。 =)
2 个解决方案
#1
2
What kind of server? If you're renting a VPS or similar you're contending with other users for CPU time.
什么样的服务器?如果您租用VPS或类似设备,则需要与其他用户竞争CPU时间。
What platform is running on both? Tell us more about your situation!
两者都运行什么平台?告诉我们您的情况!
#2
0
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.
我会检查有问题的数据库是否具有相似的范围。你说它们是相同的结构,但它们的大小是否相似?如果您的测试用例在生产量为100000000时只有100个条目,则这是性能问题的一个巨大潜在区域。
#1
2
What kind of server? If you're renting a VPS or similar you're contending with other users for CPU time.
什么样的服务器?如果您租用VPS或类似设备,则需要与其他用户竞争CPU时间。
What platform is running on both? Tell us more about your situation!
两者都运行什么平台?告诉我们您的情况!
#2
0
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.
我会检查有问题的数据库是否具有相似的范围。你说它们是相同的结构,但它们的大小是否相似?如果您的测试用例在生产量为100000000时只有100个条目,则这是性能问题的一个巨大潜在区域。