分析网络服务器的建议

发布于 2024-08-20 20:58:27 字数 470 浏览 11 评论 0原文

我用C开发了一个小型的漂亮的网络服务器,并想评估它的性能。为此,我正在执行以下操作:

在以下场景中测量套接字建立时间、文件传输时间(对于随机大小的文件)和套接字拆卸时间:

  • 单线程
  • 多线程

这应该给我吞吐量/带宽。 ..我计划在一堆计算机上进行设置并测量所有内容...对于客户端部分,我使用 PHP 并按以下方式使用简单的计时函数:

<?php
$time_start = microtime_float();
// COMMAND TO PROFILE
$time_end = microtime_float();
$time = $time_end - $time_start;
echo "Task took $time seconds\n";
?>

是否还有其他我需要的指标应该采取哪些措施来给我一些有价值的见解?

I developed a small nifty webserver in C and would like to evaluate its performance. For this I'm doing the following:

Measuring the socket establishment time, file transfer time (for files of random sizes) and socket teardown time in the following scenarios:

  • Single-Threaded
  • Multi-Threaded

And this should give me the throughput/bandwidth... I was planning on setting this up on a bunch of computers and measuring everything... For the client part, I'm using PHP and am making use of simple timing functions in the following manner:

<?php
$time_start = microtime_float();
// COMMAND TO PROFILE
$time_end = microtime_float();
$time = $time_end - $time_start;
echo "Task took $time seconds\n";
?>

Are there any other metrics that I should measure that would give me some valuable insights?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

忆梦 2024-08-27 20:58:27

如果您要分析 PHP 性能,可以使用 Xdebug (还有许多其他工具)。但如果您担心网络服务器的性能,那就另当别论了。像 Apache 这样的网络服务器也有为其开发的分析工具,例如 ab 工具

if you are profiling PHP performance, you can use Xdebug (among many others). But if you are concern about webserver performance, its a different story. webservers like Apache have profiling tools developed for it as well, eg ab tool

听风吹 2024-08-27 20:58:27

嗯,我不确定这是对请求性能进行基准测试的最佳方法。看一下 Apache 发行版提供的 ab,它是一个基本工具,但您应该能够在同一台服务器上运行它并获得更准确的请求时间基准。它还将为您提供许多其他指标。

http://httpd.apache.org/docs/2.0/programs/ab。 html

Hmm, I'm not sure it's the best approach to benchmark request performance. Take a look at ab which is provided by the Apache distribution, it's a rudimentary tool, but you should be able to run it on the same server and get a more accurate benchmark for request time. It'll also give you a bunch of other metrics.

http://httpd.apache.org/docs/2.0/programs/ab.html

别低头,皇冠会掉 2024-08-27 20:58:27

尝试使用 xDebug 进行分析,然后下载并安装 webgrind

您:

  1. 避免代码混乱并
  2. 获得更多信息、内存、调用例程的次数、例程的成本以及从何处调用它。

我怀疑您是否可以使用 PHP 分析类轻松收集此类信息

有大量教程可以帮助您入门。

alt text
(来源:jokke.dk

Try using xDebug with profiling, then download and install webgrind.

You:

  1. Avoid code clutter and
  2. Gain a lot more information, memory, how many times a routine is called, how expensive a routine is and where it was called from.

I doubt you could collect such information using a PHP profiling class with such ease

There are plently of tutorials to get you started.

alt text
(source: jokke.dk)

强者自强 2024-08-27 20:58:27

内存使用情况可能会很好。您可能还想查看某些函数被调用的频率,以了解要优化的内容(如果有的话)。

另外,Facebook 推出了一个名为 XHProf 的工具,可能值得一看:http:// mirror.facebook.net/facebook/xhprof/doc.html。有关其使用的一些附加说明如下:http://techportal。 inviqa.com/2009/12/01/profiling-with-xhprof/

Memory usage might be good. You might want to look at how frequently certain functions are being called as well to look at what to optimize if anything.

Also, Facebook put out a tool called XHProf that might be worth a look: http://mirror.facebook.net/facebook/xhprof/doc.html. Some additional instructions on its usage is here: http://techportal.inviqa.com/2009/12/01/profiling-with-xhprof/.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文