libcurl长连接高并发高性能封装测试分析源代码

上传者: baochunlei1 | 上传时间: 2021-05-11 14:06:09 | 文件大小: 17.22MB | 文件类型: RAR
项目中需要用到Curl频繁调用的情况,发现curl接口调用速度缓慢。为了实现curl高性能,高并发,需要研究如何实现高性能高并发。研究方向有三个。 (1) 长连接。考虑采用长连接的方式去开发。首先研究下长连接和短连接的性能区别。curl内部是通过socket去连接通讯。socket每次连接最为耗时,如果能够复用连接,长时间连接,减少每次socket连接的时间,则可以大大减少时间,提高效率。 (2) 多线程。单个线程下载速度毕竟有限,使用多线程去调用接口。实现高并发高性能,需要考虑资源分配和冲突的问题。 (3) 异步调用。和socket异步调用的原理类似。同步调用会阻塞等待,造成CPU占用率高。

文件下载

资源详情

[{"title":"( 79 个子文件 17.22MB ) libcurl长连接高并发高性能封装测试分析源代码","children":[{"title":"CurlHighSpeed","children":[{"title":"bin","children":null,"spread":false},{"title":"CurlHighSpeed.sln <span style='color:#111;'> 1.29KB </span>","children":null,"spread":false},{"title":"CurlHighSpeed","children":[{"title":"CurlHighSpeed.vcxproj.filters <span style='color:#111;'> 1.48KB </span>","children":null,"spread":false},{"title":"Release","children":[{"title":"RestClientPool.obj <span style='color:#111;'> 18.88KB </span>","children":null,"spread":false},{"title":"RestClient.obj <span style='color:#111;'> 12.79KB </span>","children":null,"spread":false},{"title":"CurlHighSpeed.log <span style='color:#111;'> 100B </span>","children":null,"spread":false},{"title":"main.obj <span style='color:#111;'> 10.29KB </span>","children":null,"spread":false},{"title":"CurlHighSpeed.tlog","children":[{"title":"CL.write.1.tlog <span style='color:#111;'> 1.14KB </span>","children":null,"spread":false},{"title":"CurlHighSpeed.lastbuildstate <span style='color:#111;'> 193B </span>","children":null,"spread":false},{"title":"link.command.1.tlog <span style='color:#111;'> 1.69KB </span>","children":null,"spread":false},{"title":"CL.read.1.tlog <span style='color:#111;'> 112.39KB </span>","children":null,"spread":false},{"title":"CL.command.1.tlog <span style='color:#111;'> 2.98KB </span>","children":null,"spread":false},{"title":"link.write.1.tlog <span style='color:#111;'> 490B </span>","children":null,"spread":false},{"title":"link.read.1.tlog <span style='color:#111;'> 3.93KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"RestClient.h <span style='color:#111;'> 2.32KB </span>","children":null,"spread":false},{"title":"Resources","children":null,"spread":false},{"title":"RestClient.cpp <span style='color:#111;'> 11.69KB </span>","children":null,"spread":false},{"title":"GeneratedFiles","children":null,"spread":false},{"title":"RestClientPool.h <span style='color:#111;'> 2.48KB </span>","children":null,"spread":false},{"title":"CurlHighSpeed.vcxproj <span style='color:#111;'> 9.12KB </span>","children":null,"spread":false},{"title":"main.cpp <span style='color:#111;'> 756B </span>","children":null,"spread":false},{"title":"x64","children":[{"title":"Release","children":[{"title":"RestClientPool.obj <span style='color:#111;'> 31.38KB </span>","children":null,"spread":false},{"title":"CurlHighSpeed.log <span style='color:#111;'> 3.48KB </span>","children":null,"spread":false},{"title":"main.obj <span style='color:#111;'> 1.86KB </span>","children":null,"spread":false},{"title":"CurlHighSpeed.tlog","children":[{"title":"link-rc.write.1.tlog <span style='color:#111;'> 2B </span>","children":null,"spread":false},{"title":"CL.write.1.tlog <span style='color:#111;'> 824B </span>","children":null,"spread":false},{"title":"CurlHighSpeed.lastbuildstate <span style='color:#111;'> 191B </span>","children":null,"spread":false},{"title":"link-cvtres.write.1.tlog <span style='color:#111;'> 2B </span>","children":null,"spread":false},{"title":"link.command.1.tlog <span style='color:#111;'> 2B </span>","children":null,"spread":false},{"title":"CL.read.1.tlog <span style='color:#111;'> 59.92KB </span>","children":null,"spread":false},{"title":"link-cvtres.read.1.tlog <span style='color:#111;'> 2B </span>","children":null,"spread":false},{"title":"CL.command.1.tlog <span style='color:#111;'> 1.98KB </span>","children":null,"spread":false},{"title":"unsuccessfulbuild <span style='color:#111;'> 0B </span>","children":null,"spread":false},{"title":"link-rc.read.1.tlog <span style='color:#111;'> 2B </span>","children":null,"spread":false},{"title":"link.write.1.tlog <span style='color:#111;'> 2B </span>","children":null,"spread":false},{"title":"link.read.1.tlog <span style='color:#111;'> 2B </span>","children":null,"spread":false}],"spread":false}],"spread":false},{"title":"Debug","children":[{"title":"vc140.pdb <span style='color:#111;'> 764.00KB </span>","children":null,"spread":false},{"title":"CurlHighSpeed.log <span style='color:#111;'> 171B </span>","children":null,"spread":false},{"title":"main.obj <span style='color:#111;'> 54.61KB </span>","children":null,"spread":false},{"title":"CurlHighSpeed.tlog","children":[{"title":"CL.write.1.tlog <span style='color:#111;'> 340B </span>","children":null,"spread":false},{"title":"CurlHighSpeed.lastbuildstate <span style='color:#111;'> 189B </span>","children":null,"spread":false},{"title":"link.command.1.tlog <span style='color:#111;'> 1.23KB </span>","children":null,"spread":false},{"title":"CL.read.1.tlog <span style='color:#111;'> 21.79KB </span>","children":null,"spread":false},{"title":"CL.command.1.tlog <span style='color:#111;'> 864B </span>","children":null,"spread":false},{"title":"unsuccessfulbuild <span style='color:#111;'> 0B </span>","children":null,"spread":false},{"title":"link.write.1.tlog <span style='color:#111;'> 446B </span>","children":null,"spread":false},{"title":"link.read.1.tlog <span style='color:#111;'> 3.58KB </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":true},{"title":"RestClientPool.cpp <span style='color:#111;'> 11.47KB </span>","children":null,"spread":false},{"title":"CurlHighSpeed.vcxproj.user <span style='color:#111;'> 1.07KB </span>","children":null,"spread":false}],"spread":false},{"title":".vs","children":[{"title":"CurlHighSpeed","children":[{"title":"v14","children":[{"title":".suo <span style='color:#111;'> 34.00KB </span>","children":null,"spread":false}],"spread":true}],"spread":true}],"spread":true},{"title":"include","children":[{"title":"curl","children":[{"title":"system.h <span style='color:#111;'> 18.59KB </span>","children":null,"spread":false},{"title":"easy.h <span style='color:#111;'> 3.56KB </span>","children":null,"spread":false},{"title":"stdcheaders.h <span style='color:#111;'> 1.31KB </span>","children":null,"spread":false},{"title":"urlapi.h <span style='color:#111;'> 4.39KB </span>","children":null,"spread":false},{"title":"typecheck-gcc.h <span style='color:#111;'> 41.27KB </span>","children":null,"spread":false},{"title":"mprintf.h <span style='color:#111;'> 2.03KB </span>","children":null,"spread":false},{"title":"multi.h <span style='color:#111;'> 16.69KB </span>","children":null,"spread":false},{"title":"curl.h <span style='color:#111;'> 110.97KB </span>","children":null,"spread":false},{"title":"curlver.h <span style='color:#111;'> 2.97KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"lib","children":[{"title":"libcurl_imp.lib <span style='color:#111;'> 18.26KB </span>","children":null,"spread":false},{"title":"libssl.lib <span style='color:#111;'> 119.42KB </span>","children":null,"spread":false},{"title":"libnghttp2.lib <span style='color:#111;'> 45.76KB </span>","children":null,"spread":false}],"spread":true},{"title":"Win32","children":[{"title":"Release","children":[{"title":"Qt5Widgets.dll <span style='color:#111;'> 4.22MB </span>","children":null,"spread":false},{"title":"libnghttp2.dll <span style='color:#111;'> 113.50KB </span>","children":null,"spread":false},{"title":"libcrypto-1_1.dll <span style='color:#111;'> 2.27MB </span>","children":null,"spread":false},{"title":"Qt5Svg.dll <span style='color:#111;'> 259.00KB </span>","children":null,"spread":false},{"title":"CurlHighSpeed.exe <span style='color:#111;'> 16.50KB </span>","children":null,"spread":false},{"title":"Qt5PrintSupport.dll <span style='color:#111;'> 260.00KB </span>","children":null,"spread":false},{"title":"Qt5Gui.dll <span style='color:#111;'> 4.96MB </span>","children":null,"spread":false},{"title":"libssl-1_1.dll <span style='color:#111;'> 480.62KB </span>","children":null,"spread":false},{"title":"Qt5Xml.dll <span style='color:#111;'> 147.00KB </span>","children":null,"spread":false},{"title":"libcurl.dll <span style='color:#111;'> 977.62KB </span>","children":null,"spread":false},{"title":"Qt5Network.dll <span style='color:#111;'> 961.00KB </span>","children":null,"spread":false},{"title":"Qt5Core.dll <span style='color:#111;'> 4.65MB </span>","children":null,"spread":false}],"spread":false}],"spread":true},{"title":"x64","children":[{"title":"Debug","children":[{"title":"libnghttp2.dll <span style='color:#111;'> 113.50KB </span>","children":null,"spread":false},{"title":"libcrypto-1_1.dll <span style='color:#111;'> 2.27MB </span>","children":null,"spread":false},{"title":"CurlHighSpeed.exe <span style='color:#111;'> 38.50KB </span>","children":null,"spread":false},{"title":"CurlHighSpeed.pdb <span style='color:#111;'> 940.00KB </span>","children":null,"spread":false},{"title":"CurlHighSpeed.ilk <span style='color:#111;'> 235.61KB </span>","children":null,"spread":false},{"title":"libssl-1_1.dll <span style='color:#111;'> 480.62KB </span>","children":null,"spread":false},{"title":"libcurl.dll <span style='color:#111;'> 977.62KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"CurlHighSpeed.VC.db <span style='color:#111;'> 35.09MB </span>","children":null,"spread":false}],"spread":true}],"spread":true}]

评论信息

  • JzrSoft :
    优化的curl代码没附上哟
    2021-02-03

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明