简体   繁体   English

Django在Mac OS X Lion上非常慢

[英]Django is terribly slow on Mac OS X Lion

I recently did a clean install of OS X Lion. 我最近干净安装了OS X Lion。 I'm now running Django 1.2.5 on Python 2.6.6 using virtualenv. 我现在使用virtualenv在Python 2.6.6上运行Django 1.2.5。 The MySQL version is 5.5.14 (installed via homebrew). MySQL版本是5.5.14(通过自制软件安装)。 When I run the test suite of one of my applications now, it is just insanely slow. 当我现在运行我的一个应用程序的测试套件时,它只是非常慢。 Usually the whole test suite would take about 4-5 minutes. 通常整个测试套件大约需要4-5分钟。 Now after that time it isn't even done with ~30%. 在那段时间之后,它甚至没有达到~30%。

Anybody any ideas on how I could narrow down the bottleneck? 关于如何缩小瓶颈的任何想法? Could it be the fresh install of MySQL is just configured bad? 可能是MySQL的全新安装配置不好吗? How would I benchmark MySQL best and what might be the issue with the (InnoDB) tables? 我如何最好地对MySQL进行基准测试以及(InnoDB)表可能存在什么问题? Maybe I'm not the only one having these problems... 也许我不是唯一一个遇到这些问题的人......

OK, so to answer my own question, I found out it was actually just bad default settings for the MySQL installation. 好的,所以为了回答我自己的问题,我发现它实际上只是MySQL安装的错误默认设置。 I ran over this script called MySQLTuner and it showed me some variables I should change. 我跑过这个名为MySQLTuner的脚本,它向我展示了一些我应该改变的变量。 After following it's recommendations the tests finish in normal times again. 遵循它的建议后,测试再次在正常时间完成。

According to this TechCrunch article: Nine Things You Should Do After Installing OS X Lion , Lion is re-indexing your files. 根据TechCrunch的这篇文章: 在安装OS X Lion后你应该做的九件事 ,Lion正在重新索引你的文件。 Leave it alone for a good few hours. 好好放几个小时。

Following link may help >> http://www.stereoplex.com/blog/speeding-up-django-unit-test-runs-with-mysql 以下链接可能有所帮助>> http://www.stereoplex.com/blog/speeding-up-django-unit-test-runs-with-mysql

I config /etc/my.cnf with this suggestion, and Django runs fast! 我用这个建议配置/etc/my.cnf,Django跑得快!

[mysqld]
skip-sync-frm=OFF

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM