mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
translated (#4752)
* Create 20161202 httpstat – A Curl Statistics Tool to Check Website Performance.md * Delete 20161202 httpstat – A Curl Statistics Tool to Check Website Performance.md
This commit is contained in:
parent
a2d7e5f5d1
commit
5521a58f7f
@ -1,68 +1,65 @@
|
||||
wyangsun translating
|
||||
httpstat – A Curl Statistics Tool to Check Website Performance
|
||||
httpstat – 一个 Curl 检查网站性能的统计分析工具
|
||||
============================================================
|
||||
|
||||
httpstat is a Python script that reflects curl statistics in a fascinating and well-defined way, it is a single file which is compatible with Python 3 and requires no additional software (dependencies) to be installed on a users system.
|
||||
httpstat 是一个 Python 脚本,它以美妙妥善的方式反映了 curl 统计分析,它是一个单独的文件,兼容 Python 3 再用户的系统上不用安装额外的软件(依赖)。
|
||||
|
||||
It is fundamentally a wrapper of cURL tool, means that you can use several valid cURL options after a URL(s), excluding the options -w, -D, -o, -s, and -S, which are already employed by httpstat.
|
||||
从根本上来说它是 cURL 包装工具,意味着你可以在 URL 后使用几个有效的 cURL 选项,不包括 -w, -D, -o, -s, 和 -S选项,这些已经被 httpstat 使用了。
|
||||
|
||||
[
|
||||
![httpstat Curl Statistics Tool ](http://www.tecmint.com/wp-content/uploads/2016/12/httpstat-Curl-Statistics-Tool.png)
|
||||
][5]
|
||||
|
||||
httpstat Curl Statistics Tool
|
||||
httpstat Curl 统计分析工具
|
||||
|
||||
You can see in the above image an ASCII table displaying how long each process took, and for me the most important step is “server processing” – if this number is higher, then you need to [tune your server to speed up website][6].
|
||||
你可以看到上图一个 ASCII 表显示了每个过程消耗多长时间,对我来说最重要的一步是“服务器过程” – 如果这个数字很高,那么你需要[调整你网站服务器的速度][6]。
|
||||
|
||||
For website or server tuning you can check our articles here:
|
||||
网站或服务器调整你可以查看我们的文章:
|
||||
|
||||
1. [5 Tips to Tune Performance of Apache Web Server][1]
|
||||
2. [Speed Up Apache and Nginx Performance Upto 10x][2]
|
||||
3. [How to Boost Nginx Performance Using Gzip Module][3]
|
||||
4. [15 Tips to Tune MySQL/MariaDB Performance][4]
|
||||
1. [5 个调整 Apache Web 服务器性能的技巧][1]
|
||||
2. [使Apache 和 Nginx 性能提升10倍][2]
|
||||
3. [如何使用 Gzip 模块提高 Nginx性能][3]
|
||||
4. [15个调整 MySQL/MariaDB 性能的建议][4]
|
||||
|
||||
Grab httpstat to check out your website speed using following instillation instructions and usage.
|
||||
使用下面安装说明和用法来获取 httpstat 检查出你的网站速度。
|
||||
|
||||
### Install httpstat in Linux Systems
|
||||
### 在 Linux 系统中安装 httpstat
|
||||
|
||||
You can install httpstat utility using two possible methods:
|
||||
|
||||
1. Get it directly from its Github repo using the [wget command][7] as follows:
|
||||
你可以使用两种合理的方法安装通用的 httpstat :
|
||||
|
||||
1. 使用 [wget 命令][7]直接从他的 Github 仓库获取如下:
|
||||
```
|
||||
$ wget -c https://raw.githubusercontent.com/reorx/httpstat/master/httpstat.py
|
||||
```
|
||||
|
||||
2. Using pip (this method allows httpstat to be installed on your system as a command) like so:
|
||||
2. 使用 pip(这个方法允许httpstat作为命令安装到你的系统中)像这样:
|
||||
|
||||
```
|
||||
$ sudo pip install httpstat
|
||||
```
|
||||
注:确保 pip 包已经在系统上安装了,如果没使用你的发行版包管理器 [yum][8] 或 [apt][9]安装它。
|
||||
|
||||
Note: Make sure pip package installed on the system, if not install it using your distribution package manager [yum][8] or [apt][9].
|
||||
### 在 Linux 中如何使用httpstat
|
||||
|
||||
### How to Use httpstat in Linux
|
||||
|
||||
httpstat can be used according to the way you installed it, if you directly downloaded it, run it using the following syntax from within the download directory:
|
||||
httpstat 可以根据你安装它的方式来使用,如果你直接下载了它,进入下载目录使用下面的语句运行它:
|
||||
|
||||
```
|
||||
$ python httpstat.py url cURL_options
|
||||
```
|
||||
|
||||
In case you used pip to install it, you can execute it as a command in the form below:
|
||||
如果你使用 pip 来安装它,你可以作为命令来执行它,如下表:
|
||||
|
||||
```
|
||||
$ httpstat url cURL_options
|
||||
```
|
||||
|
||||
To view the help page for httpstat, issue the command below:
|
||||
查看 httpstat 帮助页,命令如下:
|
||||
|
||||
```
|
||||
$ python httpstat.py --help
|
||||
OR
|
||||
$ httpstat --help
|
||||
```
|
||||
httpstat help
|
||||
httpstat 帮助
|
||||
```
|
||||
Usage: httpstat URL [CURL_OPTIONS]
|
||||
httpstat -h | --help
|
||||
@ -89,11 +86,11 @@ from current shell $PATH.
|
||||
HTTPSTAT_DEBUG Set to `true` to see debugging logs. Default is `false`
|
||||
```
|
||||
|
||||
From the output of the help command above, you can see that httpstat has a collection of useful environmental variables that influence its behavior.
|
||||
从上面帮助命令的输出,你可以看出 httpstat 已经具备了一些可以影响其行为的环境变量。
|
||||
|
||||
To use them, simply export the variables with the appropriate value in the `.bashrc` or `.zshrc` file.
|
||||
使用他们,只需输出适当的值的变量到`.bashrc` 或 `.zshrc` 文件。
|
||||
|
||||
For instance:
|
||||
例如:
|
||||
|
||||
```
|
||||
export HTTPSTAT_SHOW_IP=false
|
||||
@ -102,15 +99,15 @@ export HTTPSTAT_SAVE_BODY=false
|
||||
export HTTPSTAT_DEBUG=true
|
||||
```
|
||||
|
||||
Once your are done adding them, save the file and run the command below to effect the changes:
|
||||
你一旦添加完他们,保存文件然后运行下面的命令使改变生效:
|
||||
|
||||
```
|
||||
$ source ~/.bashrc
|
||||
```
|
||||
|
||||
You can as well specify the cURL binary path to use, the default is curl from current shell [$PATH environmental variable][10].
|
||||
你可以指定使用 cURL 执行文件的路径,默认使用的是当前 shell 的 [$PATH 环境变量][10]。
|
||||
|
||||
Below are a few examples showing how httpsat works.
|
||||
下面是一些展示 httpstat 如何工作的例子。
|
||||
|
||||
```
|
||||
$ python httpstat.py google.com
|
||||
@ -121,13 +118,13 @@ $ httpstat google.com
|
||||
![httpstat - Showing Website Statistics](http://www.tecmint.com/wp-content/uploads/2016/12/httpstat.png)
|
||||
][11]
|
||||
|
||||
httpstat – Showing Website Statistics
|
||||
httpstat – 展示网站统计分析
|
||||
|
||||
In the next command:
|
||||
接下来的命令:
|
||||
|
||||
1. `-x` command flag specifies a custom request method to use while communicating with the HTTP server.
|
||||
2. `--data-urlencode` data posts data (a=b in this case) with URL-encoding turned on.
|
||||
3. `-v` enables a verbose mode.
|
||||
1. `-X` 命令标记指定一个客户与 HTTP 服务器连接的请求方法。
|
||||
2. `--data-urlencode` 这个选项将会把数据按 URL-encoding 编码后再提交。
|
||||
3. `-v` 开启详细模式。
|
||||
|
||||
```
|
||||
$ python httpstat.py httpbin.org/post -X POST --data-urlencode "a=b" -v
|
||||
@ -136,18 +133,18 @@ $ python httpstat.py httpbin.org/post -X POST --data-urlencode "a=b" -v
|
||||
![httpstat - Custom Post Request](http://www.tecmint.com/wp-content/uploads/2016/12/httpstat-Post-Request.png)
|
||||
][12]
|
||||
|
||||
httpstat – Custom Post Request
|
||||
httpstat – 定制提交请求
|
||||
|
||||
You can look through the cURL man page for more useful and advanced options or visit the httpstatGithub repository: [https://github.com/reorx/httpstat][13]
|
||||
你可以查看 cURL 的帮助获取更多有用的高级选项,或者浏览 httpstat 的 Github 仓库:[https://github.com/reorx/httpstat][13]
|
||||
|
||||
In this article, we have covered a useful tool for monitoring cURL statistics is a simple and clear way. If you know of any such tools out there, do not hesitate to let us know and you can as well ask a question or make a comment about this article or httpstat via the feedback section below.
|
||||
这篇文章中,我们覆盖了一个有效的工具,它以简单和整洁方式来查看 cURL 统计分析。如果你知道任何类似的工具,别犹豫,让我们知道,你也可以问问题或评论这篇文章或 httpstat,通过下面反馈。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/httpstat-curl-statistics-tool-check-website-performance/
|
||||
|
||||
作者:[Aaron Kili][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[译者ID](https://github.com/wyangsun)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 组织编译,[Linux中国](https://linux.cn/) 荣誉推出
|
Loading…
Reference in New Issue
Block a user