实时测试的性能日志?
我们正在完成用 PHP/MySQL(+ memcached)编写的应用程序,我们将在下周末开始一个晚上的现场测试(这是一种“社交”应用程序)。
当然,我们将监视错误日志文件以确保一切顺利。但我们还希望保留应用程序性能的日志:例如,确定脚本是否运行太慢,更详细地了解函数/方法运行所需的时间、执行 MySQL 查询的时间并进行比较从 memcached 获取的数据(和“un-jsoned”)。
这是我第一次做这样的事情:但是,我相信这是根本性的,因为我们需要确保当我们的客户在 10-15 天内开始使用应用程序时,应用程序能够正确扩展。 (向上)扩展不会是一个大问题,因为我们使用的是云服务器(我们将从由一家知名公司提供的具有 256 MB RAM 的单个实例开始),但我们希望确保资源得到使用高效。
您对本次监测有何建议?好的做法?好文章值得一读吗?
另外,当测试结束后,我们是否应该继续监控现场环境的表现?即使不是所有请求,而只是样本?
PS:将所有 MySQL 查询及其运行时间记录在一个文件中是个好主意吗?
We are completing our application, written in PHP/MySQL (+ memcached) and we are going to start, next weekend, a live test for one night (it's a sort of "social" application).
We will, of course, monitor error log files to make sure everything went fine. But we would like also to keep logs of the performance of the application: for example, determine if a script ran too slow, and more in details how long it took for functions/methods to run, for MySQL queries to be executed and compare that with data obtained (and "un-jsoned") from memcached.
This is the first time I'm doing something like this: however, I believe it's fundamental because we need to make sure the application will scale correctly when our customers will start using it in 10-15 days. (Up)scaling will not be a big issue, since we are using cloud servers (we will start with a single instance with 256 MB of RAM, provided by a well-known company), but we would like to be sure resources are used efficiently.
Do you have any suggestion for this monitoring? Good practices? Good articles to read?
Also, when the test is over, should we continue to monitor performances on the live environment? Even if not on all requests, but just on a sample?
PS: Is it a good idea to log on a file all MySQL queries and the time they took to run?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我通常对我的工作进行单元测试,这样我就可以确保它以令人满意的速度运行,给出正确的结果等。
一旦我完成了单元测试,我就会对其进行压力测试,我通过一个疯狂的循环运行最常用的函数我的本地机器和我为残酷测试我的应用程序而设置的实例,由于我的测试是用 PHP 编写的,所以我可以记录我喜欢的任何内容;
例如性能,但我永远不会在现场使用它,我只是确定我对我所写的内容充满信心
[编辑]
你使用 Zend Studio 吗? (这是我使用的 PHP IDE)因为它内置了单元测试,你可以在这里获得免费试用,当它结束时仍然非常有用,我有付费版本,所以我不确定单元测试是否仍然可行,但是它非常值得!
这是介绍单元测试的链接,非常棒,您可以试用 Zend Studio 这里
这里有一些刚刚从 Google 获取的单元测试链接。
lastcraft.com
单元测试列表
另一篇关于 PHP 单元测试的 Stack Overflow 帖子
Google 结果页
I usually unit test my work so I can make sure its running at a satisfactory speed, giving the right results, etc.
Once I've finished unit testing I will stress test it, I run the most commonly used functions through an insane loop from my local machine and an instance I have set up for brutally testing my applications and since my tests are written in PHP I can log anything i like;
Such as performance, but I would never use it live I'd just be sure I'm confident with what I have written
[EDIT]
Do you use Zend Studio? (that's the PHP IDE I use) because it has built in unit testing, you can get a free trial here which when it ends is still very functional, I have the paid version so I'm not sure if unit testing is still viable but its well worth its buck!
Here's a link that introduces unit testing which is really great and you can grab the trial of Zend Studio here
here are a few more links for unit testing just pulled from Google.
lastcraft.com
List of unit testing
Another Stack Overflow post on unit testing PHP
Google results page
您可以考虑在计算机上安装类似的东西:
http://en。 wikipedia.org/wiki/Cacti_%28software%29
拥有有关系统性能(CPU\Mem\Bandwidth)的当前和历史信息总是很方便。
you could look at installing something like this on the machine(s):
http://en.wikipedia.org/wiki/Cacti_%28software%29
It's always handy to have current and historical information about the performance of you system (CPU\Mem\Bandwidth).