python实现自动监测目标网站的爬取速度_以及整体网络环境分析

news/2024/5/13 10:06:36/文章来源:https://blog.csdn.net/zwq912318834/article/details/77411148

python实现自动监测目标网站的爬取速度_以及整体网络环境分析

实现的功能:在win7下,分别通过使用和不使用代理获取网页速度,以及使用系统自带的ping,tracert命令分析整个网络的环境,分析爬虫在速度上的瓶颈,以及排查解决网络故障。

分四步:

  • 第一步:计算不使用代理获取目标网页的平均速度。
  • 第二步:计算使用代理获取目标网页的平均速度。
  • 第三步:使用win7自带的ping命令测试网络的连通度。
  • 第四步:使用win7自带的tracert命令查看网络各节点路由的连通度。

1. 环境。

  • Python:3.6.1
  • Python IDE:pycharm
  • 系统:win7

2. 影响爬虫爬取速度的关键因素。

首先,思考一下,爬虫爬取目标网站的速度受哪几个因素的影响?

  • 第一,本地网络带宽。
  • 第二,代理的稳定性,以及到目标网站的速度。
  • 第三,目标网站的状态。
  • 第四,本地,代理,目标网站之间的网络链路状态。

3. 监测哪些数据?

3.1. 使用本地网络访问目标网站的速度

在不使用代理的情况下,访问目标网站的不同详情页,计算访问每个网页需要的时间,成功率,以及失败率。
For example:

# python 3.6.1
import requests
import datetime
detailUrl = "www.amazon.com"
startTime = datetime.datetime.now()
response = requests.get(url=detailUrl, timeout = myTime)
endTime = datetime.datetime.now()
usedTime = endTime - startTime
success_count = 0           # statusCode == 200
if response.status_code == 200:success_count += 1

注意:
1. 使用本地网络访问时,一定要注意目标网站的反爬技术,最好是设置延时 time.sleep(5)。

3.2. 使用代理访问目标网站的速度 —— 与3.1进行对比

使用代理,访问目标网站的不同详情页,计算访问每个网页需要的时间,成功率,以及失败率。
For example:

# python 3.6.1
import requests
import datetime
url = "www.amazon.com"
proxies = {"http": proxy,"https": proxy}
header = {"User-Agent": "Mozilla/2.0 (compatible; Ask Jeeves/Teoma)"}
success_count = 0           # statusCode == 200
connectFail_count = 0       # statusCode != 200 or timeout
proxyFail_count = 0         # requests Exception
startTime = datetime.datetime.now()
try:s = requests.session()response = s.get(url=url, proxies=proxies, headers=header, timeout=30)endTime = datetime.datetime.now()usedTime = endTime - startTimeif response.status_code == 200:success_count += 1else:connectFail_count += 1
except Exception as e:proxyFail_count += 1print( f"Exception: url={url}, e:{e}")

注意:
1. 使用代理访问时,为了防止程序异常终止,最好加上异常处理,因为代理总会有这样那样的问题。

3.3. 使用ping命令来测试目标网站的连通度

使用系统自带的ping命令,查看目标网站的网络连通度,以及延时信息。
For example:

# python 3.6.1
import subprocess
import os
ip_address = "www.amazon.com"
p = subprocess.Popen(["ping.exe", ip_address],stdin = subprocess.PIPE,stdout = subprocess.PIPE,stderr = subprocess.PIPE,shell = True)
# 在Windows上需要用gbk解码,python默认utf-8,会出现乱码
cmdOut = p.stdout.read().decode('gbk') 

结果:
这里写图片描述

注意:
1. 指标:一般延时在100ms以下说明连通度非常高。还需要关注丢包率。

3.4. 使用tracert命令来查看到目标网站的路由详情

使用系统自带的tracert命令,查看到目标网站需要经过多少跳路由,到每个路由的时间,协助分析整个网络链路状态。
For example:

# python 3.6.1
import subprocess
import os
ip_address = "www.amazon.com"
p = subprocess.Popen(["tracert.exe", ip_address],stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)
# 在Windows上需要gbk解码,python默认utf-8,会出现乱码
cmdOut = p.stdout.read().decode('gbk') 

结果:
这里写图片描述

注意:
- 访问 http://www.ip138.com/ips138.asp?ip=52.84.239.51&action=2 就能查到IP对应的地址在哪,注意将ip的值更换成自己的。
- 请求超时的,不是指链路不通,而是这个节点路由不遵守这个协议,不返回包。

这些信息能说明什么?

  • 第一,对比3.1和3.2的数据,可以知道爬虫速度的瓶颈在哪。如果使用代理和不使用代理速度差不多,那么瓶颈就在本地带宽,想提升爬取速度,就要想办法提高本地网速。反之,就是代理拉慢了爬虫速度,需要寻找更稳定更快速的代理。
  • 第二,如果爬虫爬不动了,首先要检查一下目标网站的连通度,因为有可能是服务器故障。
  • 第三,如果ping的结果不理想,延时很大,tracert结果有助于我们分析是哪一段网络之间发生问题,再去思考详细的解决方案。

4. 代码详解

  • 4.1. Import包:
# python 3.6.1
import subprocess
import re
import time
import datetime
import functools
from ftplib import FTP
import os
import requests
import random
  • 4.2. 定义配置信息:
# 定义配置信息
domains = ["www.amazon.com", "www.amztracker.com"]  # 待测试的域名
target_folder = r"F:\NetworkEnvDaily\\"             # 测试结果文件存放位置
ftp_url = "192.168.0.101"                           # FTP服务器地址
ftp_port = 21                                       # FTP服务端口号
ftpUploadFolder = "NetworkEnvup"                    # 文件上传至FTP服务器的位置
ids_req = ["B018A2RRG4", "B002GCJOC0", "0071386211", "B00MHIKRIS"]  # 用于构造detaiUrl
useragent = ['Mozilla/2.0 (compatible; Ask Jeeves/Teoma)','Baiduspider ( http://www.baidu.com/search/spider.htm)','FAST-WebCrawler/3.8 (crawler at trd dot overture dot com; http://www.alltheweb.com/help/webmaster/crawler)','AdsBot-Google ( http://www.google.com/adsbot.html)','Mozilla/5.0 (compatible; Googlebot/2.1;  http://www.google.com/bot.html)'
]
  • 4.3. 定义装饰器,计算函数执行时间:
# 装饰器
def timeDecorator(func):'''装饰器,记录函数的执行时间:param func::return:'''@functools.wraps(func)   # 方便调试,堆栈能显示真实的func name,而不是wrapperdef wrapper(*args, **kwargs):startTime = datetime.datetime.now()print(f"Enter func:{func.__name__} at {startTime}")res = func(*args, **kwargs)endTime = datetime.datetime.now()print(f"Leave func:{func.__name__} at {endTime}, usedTime: {endTime-startTime}")return resreturn wrapper
  • 4.4. 定义Log处理和url构造函数:
# 处理Log
def myHandleLog(toSave, log):'''保存Log,用于写到文件中,并打印log。因为str是不可变量:param toSave::param log::return:'''toSave += logtoSave += '\n'print(log)return toSavedef getUrlsFromIds(domain, ids_lst):'''构造url,amazon商品详情页url格式:www.amazon.com/dp/ASIN_ID:param domain: domain of amazon:param ids_lst: batch operator:return:'''urls_lst = [f"http://{domain}/dp/{ID}" for ID in ids_lst]return urls_lst
  • 4.5. 定义 ping ip_address 的函数:
# Ping IP 测试网络连通度
@timeDecorator
def get_ping_result(ip_address):'''测试目标网站的连通度,也测试本地到目标站的网速。:param ip_address: ping ip_address:return:'''p = subprocess.Popen(["ping.exe", ip_address],stdin = subprocess.PIPE,stdout = subprocess.PIPE,stderr = subprocess.PIPE,shell = True)cmdOut = p.stdout.read().decode('gbk') # 在Windows上需要用gbk解码,python默认utf-8,会出现乱码# 定义正则表达式,筛选数字,提取连通率信息re_receive = "已接收 = \d"re_lost = "丢失 = \d"re_ip = "来自 [\d\.]+"match_receive = re.search(re_receive, cmdOut)match_lost = re.search(re_lost, cmdOut)match_ip = re.search(re_ip, cmdOut)receive_count = -1if match_receive:receive_count = int(match_receive.group()[6:])lost_count = -1if match_lost:lost_count = int(match_lost.group()[5:])re_ip = "127.0.0.1"if match_ip:re_ip = match_ip.group()[3:]# 接受到的反馈大于0,表示网络通,提取延时信息if receive_count > 0:re_min_time = '最短 = \d+ms're_max_time = '最长 = \d+ms're_avg_time = '平均 = \d+ms'match_min_time = re.search(re_min_time, cmdOut)min_time = int(match_min_time.group()[5:-2])match_max_time = re.search(re_max_time, cmdOut)max_time = int(match_max_time.group()[5:-2])match_avg_time = re.search(re_avg_time, cmdOut)avg_time = int(match_avg_time.group()[5:-2])return [re_ip, receive_count, lost_count, min_time, max_time, avg_time]else:print(f"网络不通,{ip_address}不可达")return ["127.0.0.1", 0, 9999, 9999, 9999, 9999]
  • 4.6. 定义 tracert ip_address 的函数:
# tracert IP 查看各网络节点连通情况
@timeDecorator
def get_tracert_result(ip_address):p = subprocess.Popen(["tracert.exe", ip_address],stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)# 在Windows上需要gbk解码,python默认utf-8,会出现乱码cmdOut = p.stdout.read().decode('gbk') return cmdOut
  • 4.7. 统计使用Abuyun代理访问url 的速度:
# 根据abuyun提供的隧道号,密钥,生成动态代理。需要购买,此处只是示例,不可用
def getProxyFromAbuyun(tunnel, secret):# proxy = f'http://AMAZONU62J941J01:LUI52JRD425UFDDK@proxy.abuyun.com:9020'proxy = f'http://{tunnel}:{secret}@proxy.abuyun.com:9020'return proxy# 测量使用代理访问目标urls需要消耗的时间
@timeDecorator
def statisticSpeedOfProxy(urls, proxy):'''主要是统计使用代理时,访问成功,失败数,以及成功的情况下,访问每条url的平均时间:param urls: 用来测试的url集合:param proxy: 使用的代理:return: 详细的日志信息'''detail_log = f"The result of use Abuyun proxy:{proxy}\n"proxies = {"http": proxy,"https": proxy}header = {"User-Agent": random.choice(useragent)}success_count = 0           # statusCode == 200connectFail_count = 0       # statusCode != 200 or timeoutproxyFail_count = 0         # requests ExceptiontotalSuccessTime = 0for url in urls:startTime = datetime.datetime.now()try:s = requests.session()response = s.get(url=url, proxies=proxies, headers=header, timeout=10)endTime = datetime.datetime.now()usedTime = endTime - startTimedetail_log = myHandleLog(detail_log, f"request url:{url}, statusCode:"f"{response.status_code}, usedTime:{usedTime}")# print(f"request url:{url}, response.statusCode: {response.status_code}, usedTime:{usedTime}")if response.status_code == 200:success_count += 1totalSuccessTime += usedTime.total_seconds()else:connectFail_count += 1except Exception as e:proxyFail_count += 1detail_log = myHandleLog(detail_log, f"Exception: url={url}, e:{e}")time.sleep(1)   # 控制好时间间隔avgTime = "100000"  # 定义不可访问的值if success_count != 0:avgTime = totalSuccessTime / success_countdetail_log = myHandleLog(detail_log, f"Statistic_proxy, total:{len(urls)}: "f"success:{success_count}, "f"totalSuccessTime:{totalSuccessTime}, "f"avgTime:{avgTime}, "f"connectFail_count:{connectFail_count}, "f"proxyFail_count:{proxyFail_count}")return ( len(urls), success_count, totalSuccessTime, avgTime, connectFail_count,proxyFail_count, detail_log )
  • 4.8. 统计不使用代理访问url 的速度:
# 测量不使用代理访问目标urls需要消耗的时间
@timeDecorator
def statisticSpeedWithoutProxy(urls):'''主要是统计不使用代理时,访问成功,失败数,以及成功的情况下,访问每条url的平均时间尤其需要主要好时间间隔,以防网站反爬,IP被封:param urls: 用来测试速度的url集合:return: 详细的日志信息'''detail_log = f"The result of not use proxy:\n"header = {"User-Agent": random.choice(useragent)}success_count = 0       # statusCode == 200connectFail_count = 0   # statusCode != 200 or timeoutunknowFail_count = 0    # requests ExceptiontotalSuccessTime = 0for url in urls:startTime = datetime.datetime.now()try:s = requests.session()response = s.get(url=url, headers=header, timeout=10)endTime = datetime.datetime.now()usedTime = endTime - startTimedetail_log = myHandleLog(detail_log, f"request url:{url}, statusCode:"f"{response.status_code}, usedTime:{usedTime}")# print(f"request url:{url}, response.statusCode: {response.status_code}, usedTime:{usedTime}")if response.status_code == 200:success_count += 1totalSuccessTime += usedTime.total_seconds()else:connectFail_count += 1except Exception as e:unknowFail_count += 1detail_log = myHandleLog(detail_log, f"Exception: url={url}, e:{e}")time.sleep(5)  # 控制好时间间隔avgTime = "100001" # 定义不可访问的值if success_count != 0:avgTime = totalSuccessTime / success_countdetail_log = myHandleLog(detail_log, f"Statistic_No_proxy, total:{len(urls)}: "f"success:{success_count}, "f"totalSuccessTime:{totalSuccessTime}, "f"avgTime:{avgTime}, "f"connectFail_count:{connectFail_count}, "f"proxyFail_count:{unknowFail_count}")return ( len(urls), success_count, totalSuccessTime, avgTime, connectFail_count,unknowFail_count, detail_log )
  • 4.9. 上传统计结果文件到FTP服务器:
# 上传文件至FTP服务器
@timeDecorator
def ftpUpload(filename, folder, ftp_url, ftp_port):''':param filename: 待上传文件路径:param folder: 文件上传至FTP服务器上的存储目录:param ftp_url: FTP服务器IP:param ftp_port: 端口号,默认为21:return: status code'''startTime = datetime.datetime.now()print(f"Enter func ftpUpload, time:{startTime}")ftp = FTP()ftp.set_debuglevel(2)  # set debug level, detail info:2, close:0ftp.connect(ftp_url, ftp_port)ftp.login('', '')  # 登录,如果匿名登录则用空串代替print(ftp.getwelcome())  # ext: *welcome* '220 Microsoft FTP Service'ftp.cwd(folder)  # Change to a directory on FTP serverbufsize = 1024  # 设置缓冲块大小file_handler = open(filename, 'rb')  # 读模式在本地打开文件res = -1try:# 为了避免程序终止,忽略可能出现的错误res = ftp.storbinary(f"STOR {os.path.basename(filename)}", file_handler, bufsize)  # upload fileexcept Exception as e:print(f"except: {e}, cannot upload file: {ftp_url}:{ftp_port} {filename}")finally:ftp.set_debuglevel(0)  # 关闭debug信息file_handler.close()ftp.quit()endTime = datetime.datetime.now()print(f"Upload done, leave func ftpUpload, time:{endTime}, usedTime:{endTime-startTime}")return res
  • 4.10. 主程序main:
if __name__ == '__main__':# 按时间给文件命名MainRunTime = datetime.datetime.now()fileName = f"statisticNetworkEnv{MainRunTime.year}{MainRunTime.month}{MainRunTime.day}.txt"amazonDeatilUrls = getUrlsFromIds("www.amazon.com", ids_req)conclusion_content = ""         # 写入文件的结论性信息detail_content = ""             # 写入文件的详细信息# 测试爬虫使用代理的速度content = "\n###### Speed of get url page ######\nThe speed result of Abuyun proxy(amazon) for" \" amazon detail page: proxy = AMAZONU62J941J01:LUI52JRD425UFDDK\n"conclusion_content += contentprint(content)proxy = getProxyFromAbuyun("AMAZONU62J941J01", "LUI52JRD425UFDDK")res = statisticSpeedOfProxy(urls=amazonDeatilUrls, proxy=proxy)# res: [len(urls), success_count, totalSuccessTime, avgTime, connectFail_count, proxyFail_count, detail_log]conclusion_content += f"Amazon Totalurls:{res[0]}, successCount:{res[1]}, totalSuccessTime:{res[2]}, " \f"avgTime:{res[3]}, connectFailCount:{res[4]}, proxyFailCount:{res[5]}\n\n"detail_content += res[6]# 测试不使用代理爬取amazon商品详情网页的速度content = "The speed result of not use proxy for amazon detail page. \n"conclusion_content += contentprint(content)res = statisticSpeedWithoutProxy(urls=amazonDeatilUrls)# res: [len(urls), success_count, totalSuccessTime, avgTime, connectFail_count, unknowFail_count, detail_log]conclusion_content += f"No_proxy Totalurls:{res[0]}, successCount:{res[1]}, totalSuccessTime:{res[2]}, " \f"avgTime:{res[3]}, connectFailCount:{res[4]}, unknowFail_count:{res[5]}\n"detail_content += res[6]# 测试pingcontent = f"\n##### Speed of ping ######\n"conclusion_content += contentprint(content)for domain in domains:content = f"The speed result of ping {domain}.\n"conclusion_content += contentprint(content)res = get_ping_result(domain)# return [re_ip, receive_count, lost_count, min_time, max_time, avg_time]content = f"result of ping {domain}:{res[0]}, receive_count:{res[1]}, lost_count:{res[2]}, " \f"min_time:{res[3]}, max_time:{res[4]}, avg_time:{res[5]} \n\n"conclusion_content += contentprint(content)# 测试tracertcontent = f"\n##### Speed of tracert ######\n"conclusion_content += contentprint(content)for domain in domains:content = f"The speed result of tracert {domain}. \n"conclusion_content += contentprint(content)res = get_tracert_result(domain)# return cmdOutcontent = f"{res}\n\n"conclusion_content += resprint(content)# 打印统计结果print(f"###### conclusion_content: \n {conclusion_content}")print(f"###### detail_content: \n {detail_content}")# 写入文件try:f = open(f"{target_folder}{fileName}", "w")     # 按覆盖文件的方式打开f.write(f"###### conclusion ######\n{conclusion_content}\n")f.write(f"###### detail ######\n{detail_content}\n")except Exception as e:print(f"Exception: {e}")finally:if f:f.close()print(f"fileName: {fileName}")# 上传到FTP服务器ftp_res = ftpUpload(f"{target_folder}{fileName}", ftpUploadFolder, ftp_url, ftp_port)print(f"ftp_res: {ftp_res}")

5. 效果

5.1. 生成结论

这里写图片描述

###### conclusion ############# Speed of get url page ######
The speed result of Abuyun proxy(amazon) for amazon detail page: proxy = AMAZONU62J941J01:LUI52JRD425UFDDK
Amazon Totalurls:4, successCount:4, totalSuccessTime:17.214000000000002, avgTime:4.3035000000000005, connectFailCount:0, proxyFailCount:0The speed result of not use proxy for amazon detail page. 
No_proxy Totalurls:4, successCount:4, totalSuccessTime:6.484999999999999, avgTime:1.6212499999999999, connectFailCount:0, proxyFailCount:0##### Speed of ping ######
The speed result of ping www.amazon.com.
result of ping www.amazon.com:52.84.239.51, receive_count:4, lost_count:0, min_time:159, max_time:186, avg_time:167 The speed result of ping www.amztracker.com.
result of ping www.amztracker.com:104.20.194.28, receive_count:4, lost_count:0, min_time:173, max_time:173, avg_time:173 ##### Speed of tracert ######
The speed result of tracert www.amazon.com. 通过最多 30 个跃点跟踪到 d3ag4hukkh62yn.cloudfront.net [52.84.239.51] 的路由:1    <1 毫秒   <1 毫秒   <1 毫秒 192.168.0.1 2     2 ms    44 ms     2 ms  100.64.0.1 3     2 ms     2 ms     2 ms  113.106.42.53 4     3 ms     3 ms     3 ms  17.107.38.59.broad.fs.gd.dynamic.163data.com.cn [59.38.107.17] 5     9 ms     7 ms     8 ms  183.56.65.62 6     5 ms     8 ms     7 ms  202.97.33.202 7     *       13 ms     7 ms  202.97.94.102 8   220 ms   219 ms   224 ms  202.97.51.106 9   160 ms   159 ms   159 ms  202.97.49.106 10   274 ms   274 ms   274 ms  218.30.53.2 11   171 ms   170 ms   165 ms  54.239.103.88 12   182 ms   185 ms   190 ms  54.239.103.97 13     *        *        *     请求超时。14   157 ms   158 ms   158 ms  54.239.41.97 15   176 ms   176 ms   177 ms  205.251.230.89 16     *        *        *     请求超时。17     *        *        *     请求超时。18     *        *        *     请求超时。19   159 ms   159 ms   159 ms  server-52-84-239-51.sfo5.r.cloudfront.net [52.84.239.51] 跟踪完成。The speed result of tracert www.amztracker.com. 通过最多 30 个跃点跟踪到 www.amztracker.com [104.20.194.28] 的路由:1    <1 毫秒   <1 毫秒   <1 毫秒 192.168.0.1 2     2 ms     2 ms     2 ms  100.64.0.1 3     2 ms     2 ms     2 ms  119.145.222.101 4     3 ms     3 ms     2 ms  183.56.67.193 5     5 ms     8 ms     7 ms  183.56.65.58 6     9 ms     8 ms    10 ms  202.97.33.214 7     5 ms     7 ms     7 ms  202.97.91.190 8     *        *        *     请求超时。9   167 ms   167 ms   167 ms  202.97.50.70 10   161 ms   162 ms   161 ms  218.30.54.70 11   190 ms   192 ms   199 ms  et-0-0-71-1.cr5-sjc1.ip4.gtt.net [89.149.137.2] 12   163 ms   167 ms   175 ms  ip4.gtt.net [173.205.51.142] 13   157 ms   158 ms   158 ms  104.20.194.28 跟踪完成。################# detail #################
The result of use Abuyun proxy:http://AMAZONU62J941J01:LUI52JRD425UFDDK@proxy.abuyun.com:9020
request url:http://www.amazon.com/dp/B018A2RRG4, statusCode:200, usedTime:0:00:04.690000
request url:http://www.amazon.com/dp/B002GCJOC0, statusCode:200, usedTime:0:00:04.777000
request url:http://www.amazon.com/dp/0071386211, statusCode:200, usedTime:0:00:04.592000
request url:http://www.amazon.com/dp/B00MHIKRIS, statusCode:200, usedTime:0:00:03.155000
Statistic_proxy, total:4: success:4, totalSuccessTime:17.214000000000002, avgTime:4.3035000000000005, connectFail_count:0, proxyFail_count:0
The result of not use proxy:
request url:http://www.amazon.com/dp/B018A2RRG4, statusCode:200, usedTime:0:00:01.574000
request url:http://www.amazon.com/dp/B002GCJOC0, statusCode:200, usedTime:0:00:01.394000
request url:http://www.amazon.com/dp/0071386211, statusCode:200, usedTime:0:00:01.473000
request url:http://www.amazon.com/dp/B00MHIKRIS, statusCode:200, usedTime:0:00:02.044000
Statistic_No_proxy, total:4: success:4, totalSuccessTime:6.484999999999999, avgTime:1.6212499999999999, connectFail_count:0, proxyFail_count:0

分析结果:
网络连通性不错,爬虫速度瓶颈在于代理的访问速度。

5.2. Log信息以及性能

###### Speed of get url page ######
The speed result of Abuyun proxy(amazon) for amazon detail page: proxy = AMAZONU62J941J01:LUI52JRD425UFDDKEnter func:statisticSpeedOfProxy at 2017-08-19 12:34:41.199200
request url:http://www.amazon.com/dp/B018A2RRG4, statusCode:200, usedTime:0:00:04.690000
request url:http://www.amazon.com/dp/B002GCJOC0, statusCode:200, usedTime:0:00:04.777000
request url:http://www.amazon.com/dp/0071386211, statusCode:200, usedTime:0:00:04.592000
request url:http://www.amazon.com/dp/B00MHIKRIS, statusCode:200, usedTime:0:00:03.155000
Statistic_proxy, total:4: success:4, totalSuccessTime:17.214000000000002, avgTime:4.3035000000000005, connectFail_count:0, proxyFail_count:0
Leave func:statisticSpeedOfProxy at 2017-08-19 12:35:18.413200, usedTime: 0:00:37.214000Enter func:statisticSpeedWithoutProxy at 2017-08-19 12:35:55.528200
request url:http://www.amazon.com/dp/B018A2RRG4, statusCode:200, usedTime:0:00:01.574000
request url:http://www.amazon.com/dp/B002GCJOC0, statusCode:200, usedTime:0:00:01.394000
request url:http://www.amazon.com/dp/0071386211, statusCode:200, usedTime:0:00:01.473000
request url:http://www.amazon.com/dp/B00MHIKRIS, statusCode:200, usedTime:0:00:02.044000
Statistic_No_proxy, total:4: success:4, totalSuccessTime:6.484999999999999, avgTime:1.6212499999999999, connectFail_count:0, proxyFail_count:0
Leave func:statisticSpeedWithoutProxy at 2017-08-19 12:39:22.014200, usedTime: 0:03:26.486000##### Speed of ping ######The speed result of ping www.amazon.com.Enter func:get_ping_result at 2017-08-19 12:39:22.014200
Leave func:get_ping_result at 2017-08-19 12:39:25.200200, usedTime: 0:00:03.186000
result of ping www.amazon.com:52.84.239.51, receive_count:4, lost_count:0, min_time:159, max_time:186, avg_time:167 The speed result of ping www.amztracker.com.Enter func:get_ping_result at 2017-08-19 12:39:25.200200
Leave func:get_ping_result at 2017-08-19 12:39:28.397200, usedTime: 0:00:03.197000
result of ping www.amztracker.com:104.20.194.28, receive_count:4, lost_count:0, min_time:173, max_time:173, avg_time:173 ##### Speed of tracert ######The speed result of tracert www.amazon.com. Enter func:get_tracert_result at 2017-08-19 12:39:28.397200
Leave func:get_tracert_result at 2017-08-19 12:42:55.191200, usedTime: 0:03:26.794000通过最多 30 个跃点跟踪
到 d3ag4hukkh62yn.cloudfront.net [52.84.239.51] 的路由:1    <1 毫秒   <1 毫秒   <1 毫秒 192.168.0.1 2     2 ms    44 ms     2 ms  100.64.0.1 3     2 ms     2 ms     2 ms  113.106.42.53 4     3 ms     3 ms     3 ms  17.107.38.59.broad.fs.gd.dynamic.163data.com.cn [59.38.107.17] 5     9 ms     7 ms     8 ms  183.56.65.62 6     5 ms     8 ms     7 ms  202.97.33.202 7     *       13 ms     7 ms  202.97.94.102 8   220 ms   219 ms   224 ms  202.97.51.106 9   160 ms   159 ms   159 ms  202.97.49.106 10   274 ms   274 ms   274 ms  218.30.53.2 11   171 ms   170 ms   165 ms  54.239.103.88 12   182 ms   185 ms   190 ms  54.239.103.97 13     *        *        *     请求超时。14   157 ms   158 ms   158 ms  54.239.41.97 15   176 ms   176 ms   177 ms  205.251.230.89 16     *        *        *     请求超时。17     *        *        *     请求超时。18     *        *        *     请求超时。19   159 ms   159 ms   159 ms  server-52-84-239-51.sfo5.r.cloudfront.net [52.84.239.51] 跟踪完成。The speed result of tracert www.amztracker.com. Enter func:get_tracert_result at 2017-08-19 12:42:55.191200
Leave func:get_tracert_result at 2017-08-19 12:45:02.005200, usedTime: 0:02:06.814000通过最多 30 个跃点跟踪
到 www.amztracker.com [104.20.194.28] 的路由:1    <1 毫秒   <1 毫秒   <1 毫秒 192.168.0.1 2     2 ms     2 ms     2 ms  100.64.0.1 3     2 ms     2 ms     2 ms  119.145.222.101 4     3 ms     3 ms     2 ms  183.56.67.193 5     5 ms     8 ms     7 ms  183.56.65.58 6     9 ms     8 ms    10 ms  202.97.33.214 7     5 ms     7 ms     7 ms  202.97.91.190 8     *        *        *     请求超时。9   167 ms   167 ms   167 ms  202.97.50.70 10   161 ms   162 ms   161 ms  218.30.54.70 11   190 ms   192 ms   199 ms  et-0-0-71-1.cr5-sjc1.ip4.gtt.net [89.149.137.2] 12   163 ms   167 ms   175 ms  ip4.gtt.net [173.205.51.142] 13   157 ms   158 ms   158 ms  104.20.194.28 跟踪完成。####### conclusion_content: ###### Speed of get url page ######
The speed result of Abuyun proxy(amazon) for amazon detail page: proxy = AMAZONU62J941J01:LUI52JRD425UFDDK
Amazon Totalurls:4, successCount:4, totalSuccessTime:17.214000000000002, avgTime:4.3035000000000005, connectFailCount:0, proxyFailCount:0The speed result of not use proxy for amazon detail page. 
No_proxy Totalurls:4, successCount:4, totalSuccessTime:6.484999999999999, avgTime:1.6212499999999999, connectFailCount:0, proxyFailCount:0##### Speed of ping ######
The speed result of ping www.amazon.com.
result of ping www.amazon.com:52.84.239.51, receive_count:4, lost_count:0, min_time:159, max_time:186, avg_time:167 The speed result of ping www.amztracker.com.
result of ping www.amztracker.com:104.20.194.28, receive_count:4, lost_count:0, min_time:173, max_time:173, avg_time:173 ##### Speed of tracert ######
The speed result of tracert www.amazon.com. 通过最多 30 个跃点跟踪
到 d3ag4hukkh62yn.cloudfront.net [52.84.239.51] 的路由:1    <1 毫秒   <1 毫秒   <1 毫秒 192.168.0.1 2     2 ms    44 ms     2 ms  100.64.0.1 3     2 ms     2 ms     2 ms  113.106.42.53 4     3 ms     3 ms     3 ms  17.107.38.59.broad.fs.gd.dynamic.163data.com.cn [59.38.107.17] 5     9 ms     7 ms     8 ms  183.56.65.62 6     5 ms     8 ms     7 ms  202.97.33.202 7     *       13 ms     7 ms  202.97.94.102 8   220 ms   219 ms   224 ms  202.97.51.106 9   160 ms   159 ms   159 ms  202.97.49.106 10   274 ms   274 ms   274 ms  218.30.53.2 11   171 ms   170 ms   165 ms  54.239.103.88 12   182 ms   185 ms   190 ms  54.239.103.97 13     *        *        *     请求超时。14   157 ms   158 ms   158 ms  54.239.41.97 15   176 ms   176 ms   177 ms  205.251.230.89 16     *        *        *     请求超时。17     *        *        *     请求超时。18     *        *        *     请求超时。19   159 ms   159 ms   159 ms  server-52-84-239-51.sfo5.r.cloudfront.net [52.84.239.51] 跟踪完成。
The speed result of tracert www.amztracker.com. 通过最多 30 个跃点跟踪
到 www.amztracker.com [104.20.194.28] 的路由:1    <1 毫秒   <1 毫秒   <1 毫秒 192.168.0.1 2     2 ms     2 ms     2 ms  100.64.0.1 3     2 ms     2 ms     2 ms  119.145.222.101 4     3 ms     3 ms     2 ms  183.56.67.193 5     5 ms     8 ms     7 ms  183.56.65.58 6     9 ms     8 ms    10 ms  202.97.33.214 7     5 ms     7 ms     7 ms  202.97.91.190 8     *        *        *     请求超时。9   167 ms   167 ms   167 ms  202.97.50.70 10   161 ms   162 ms   161 ms  218.30.54.70 11   190 ms   192 ms   199 ms  et-0-0-71-1.cr5-sjc1.ip4.gtt.net [89.149.137.2] 12   163 ms   167 ms   175 ms  ip4.gtt.net [173.205.51.142] 13   157 ms   158 ms   158 ms  104.20.194.28 跟踪完成。fileName: statisticNetworkEnv2017819.txt
Enter func:ftpUpload at 2017-08-19 12:45:02.007200
Enter func ftpUpload, time:2017-08-19 12:45:02.007200

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_771192.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

selenium+python实现1688网站验证码图片的截取

seleniumpython实现1688网站验证码图片的截取 1. 背景 在1688网站爬取数据时&#xff0c;如果访问过于频繁&#xff0c;无论用户是否已经登录&#xff0c;就会弹出如下所示的验证码登录框。 一般的验证码是类似于如下的元素&#xff08;通过链接单独加载进页面&#xff0c…

使用百度统计工具对php网站进行事件埋点追踪

使用百度统计工具对php网站进行事件埋点追踪 1.背景 在用户浏览我们的网页时&#xff0c;我们都希望知道用户从哪个途径找到并浏览我们的网站&#xff0c;然后在网站上都做了些什么。如果有了这些信息&#xff0c;我们就可以改善用户在网站上的体验&#xff0c;提高用户留存率…

如何利用网站的分布式部署(多IP)提高爬虫爬取速度?

如何利用网站的分布式部署&#xff08;多IP&#xff09;提高爬虫爬取速度&#xff1f; 1. 背景知识 做过网站部署的都清楚&#xff0c;当网站的规模和用户量巨大时&#xff0c;会采用virtual host和服务器的分布式部署方式&#xff0c;在全国多地部署服务器&#xff0c;进行用…

8个高质量免抠素材网站

8个高质量免抠素材网站 标签:免扣素材ppt 素材1.PngImg 网址&#xff1a; http://pngimg.com/ PngImg 网站是一个收录了近5万个免费的网页设计图片素材的站点&#xff0c;拥有详细的分类&#xff0c;如蔬菜、动物、水果、花卉、服装、食品、家具等等&#xff0c;所有的素材资源…

大型网站技术架构

初始搭建 最开始&#xff0c;就是各种框架一搭&#xff0c;然后扔到 Tomcat 容器中跑&#xff0c;这时候我们的文件、数据库、应用都在一个服务器上。服务分离 随着系统的上线&#xff0c;用户量也会逐步上升&#xff0c;很快一台服务器已经满足不了系统的负载&#xff0c;这时…

关于大型网站技术演进的思考(十八)--网站静态化处理—反向代理(10)

反向代理也是一种可以帮助实现网站静态化的重要技术&#xff0c;今天我就来讲讲反向代理这个主题。那么首先我们要了解下什么是反向代理。和反向代理相对应的是正向代理&#xff0c;正向代理也就是我们常说的代理服务&#xff0c;正向代理是非常常见的&#xff0c;例如在某些公…

安装PIWIK网站监控

1.piwik介绍 Piwik是一个PHP和MySQL的开放源代码的Web统计软件&#xff0c;它给你一些关于你的网站的实用统计报告&#xff0c;比如网页浏览人数&#xff0c;访问最多的页面&#xff0c;搜索引擎关键词等等。 Piwik拥有众多不同功能的插件&#xff0c;你可以添加新的功能或是移…

网站高并发高性能必不可少的九种核心技术

要建成一个具有高并发高可用的一个网站必不可少的九种核心技术转载于:https://blog.51cto.com/983865387/2045994

图书资源下载网站推荐

为什么80%的码农都做不了架构师&#xff1f;>>> Kindle 电子书下载不用愁&#xff0c;一页精品解您忧。网上流传着很多 Kindle 电子书资源网站汇总&#xff0c;但是有很多都是以讹传讹&#xff0c;有相当多的网站要么打不开&#xff0c;要么质量无法保证&#xff0…

众筹网站Kickstarter不准备上市:转型公益企业

众筹网站Kickstarter刚刚获得了“公益企业”的身份&#xff0c;表明该公司希望“对社会产生积极影响”。 需要强调的是&#xff0c;Kickstarter仍是一家盈利性企业&#xff0c;但该公司现在将会定期发布社会影响报告&#xff0c;其董事会也必须在制定决策时充分权衡公益因素。该…

大型网站技术架构(八)网站的安全架构

2019独角兽企业重金招聘Python工程师标准>>> 从互联网诞生起&#xff0c;安全威胁就一直伴随着网站的发展&#xff0c;各种Web攻击和信息泄露也从未停止。常见的攻击手段有XSS攻击、SQL注入、CSRF、Session劫持等。 1、XSS攻击 XSS攻击即跨站点脚本攻击&#xff08;…

Mysql在大型网站的应用架构演变

写在最前: 本文主要描述在网站的不同的并发访问量级下&#xff0c;Mysql架构的演变 可扩展性 架构的可扩展性往往和并发是息息相关&#xff0c;没有并发的增长&#xff0c;也就没有必要做高可扩展性的架构&#xff0c;这里对可扩展性进行简单介绍一下&#xff0c;常用的扩展手段…

github Issues解决博客网站typecho的主题lanstar报错显示你选择的风格不存在和syntax error, unexpected ‘else‘ (T_ELSE)问题

背景 最近看到小伙伴使用网站typecho搭建自己的个人博客&#xff0c;所以就尝试了一下。虽然是PHP写的&#xff0c;但感觉还不多&#xff0c;对比Java的个人博客Haro&#xff0c;最重要的一点就是有很多的主题可以供选择。 于是乎就搭建了一波&#xff0c;几经选择&#xff0…

安利一些电子图书下载网站

作者&#xff1a;duktig 博客&#xff08;文章首发&#xff09;&#xff1a;https://duktig.cn 优秀还努力。愿你付出甘之如饴&#xff0c;所得归于欢喜。 什么事情不仅香&#xff0c;还能提升自己的幸福感&#xff1f; 对于大多数人来说&#xff0c;有一点应该毋庸置疑——白嫖…

Vue3项目中 Ant Design Vue全局配置项使用及 网站标题、图标修改

1、Ant Design Vue全局配置项 Ant Design Vue官网&#xff1a;https://www.antdv.com/components/overview-cn antdv的全局配置一般用于 参数说明类型默认值版本autoInsertSpaceInButton设置为 false 时&#xff0c;移除按钮中 2 个汉字之间的空格booleantruecomponentSize设置…

大型网站技术架构(二)架构模式

2019独角兽企业重金招聘Python工程师标准>>> 每一个模式描述了一个在我们周围不断重复发生的问题及该问题解决方案的核心。这样&#xff0c;你就能一次又一次地使用该方案而不必做重复工作。 所谓网站架构模式即为了解决大型网站面临的高并发访问、海量数据、高可靠…

大型网站技术架构(二)架构模式

2019独角兽企业重金招聘Python工程师标准>>> 每一个模式描述了一个在我们周围不断重复发生的问题及该问题解决方案的核心。这样&#xff0c;你就能一次又一次地使用该方案而不必做重复工作。 所谓网站架构模式即为了解决大型网站面临的高并发访问、海量数据、高可靠…

超全的选品资源网站分享

从劳工节、万圣节到黑色星期五、圣诞节&#xff0c;所有卖家都将迎来不可错过的电商旺季。而备战旺季的第一步么就是赢在选品。把握商机符合市场潮流的选品能够让卖家事半功倍&#xff0c;快速爆单。 本篇文章小编不是提供最新的选品信息&#xff0c;小编提供的是选品网站和选…

亚马逊A9算法解析,seo 的思维做亚马逊排名

如何将站内搜索排名做到前列&#xff0c;一直都是大部分卖家比较关心的问题。很多亚马逊卖家都听说过平台内的搜索引擎中有A9算法&#xff0c;虽然官方没有正式提出SEO这个概念&#xff0c;但是SEO玩法却是在这个平台中真实存在的。 Amazon搜索引擎和常规搜索引擎有什么不同&a…

亚马逊关键词工具网站梳理

在跨境电商平台中&#xff0c;流量最大的还是属于搜索流量。所以如何设置搜索词&#xff0c;如何抓取到最优价值的搜索词&#xff0c;成为困扰大家的难题。 随着物联网的发展&#xff0c;云计算、大数据已经蓬勃发展&#xff0c;离我们最近的就是淘宝、抖音等平台的推荐机制&a…