当前位置: 首页 > news >正文

爱站网关键词查询工具海外网站seo

爱站网关键词查询工具,海外网站seo,百度seo排名优化公司哪家好,网站框架建设文章目录 1、AlbumInfoApiController --》testLock()2、redis添加键值对3、AlbumInfoServiceImpl --》testLock() 没有加锁4、使用ab工具测试4.1、安装 ab 工具4.2、查看 redis 中的值 5、添加本地锁 synchronized6、集群情况下问题演示 jvm锁#xff1a;synchronized lock 只… 文章目录 1、AlbumInfoApiController --》testLock()2、redis添加键值对3、AlbumInfoServiceImpl --》testLock() 没有加锁4、使用ab工具测试4.1、安装 ab 工具4.2、查看 redis 中的值 5、添加本地锁 synchronized6、集群情况下问题演示 jvm锁synchronized lock 只能锁住一个jvm内的资源 1、AlbumInfoApiController --》testLock() Tag(name 专辑管理) RestController RequestMapping(api/album/albumInfo) SuppressWarnings({unchecked, rawtypes}) public class AlbumInfoApiController {GetMapping(test/lock)public Result testLock() {this.albumInfoService.testLock();return Result.ok(测试分布式锁案例);}}2、redis添加键值对 3、AlbumInfoServiceImpl --》testLock() 没有加锁 Overridepublic void testLock(){Object numObj this.redisTemplate.opsForValue().get(num);if (numObj null) {this.redisTemplate.opsForValue().set(num, 1);return;}Integer num Integer.parseInt(numObj.toString());this.redisTemplate.opsForValue().set(num, num);}4、使用ab工具测试 ab 工具是 Apache Bench阿帕奇基准测试工具一个由 Apache HTTP Server 项目提供的用于测试 web 服务器性能的命令行工具。ab 主要用于生成 HTTP 请求并发送到 web 服务器以此来评估服务器的性能和响应能力。它是一个简单但功能强大的工具广泛用于压力测试和性能测试场景。 之前在redis中玩过ab测试工具httpd-toolsyum install -y httpd-tools 4.1、安装 ab 工具 [rootlocalhost ~]# yum install -y httpd-tools 已加载插件fastestmirror, langpacks[rootlocalhost ~]# ab ab: wrong number of arguments Usage: ab [options] [http[s]://]hostname[:port]/path Options are:-n requests Number of requests to perform-c concurrency Number of multiple requests to make at a time-t timelimit Seconds to max. to spend on benchmarkingThis implies -n 50000-s timeout Seconds to max. wait for each responseDefault is 30 seconds-b windowsize Size of TCP send/receive buffer, in bytes-B address Address to bind to when making outgoing connections-p postfile File containing data to POST. Remember also to set -T-u putfile File containing data to PUT. Remember also to set -T-T content-type Content-type header to use for POST/PUT data, eg.application/x-www-form-urlencodedDefault is text/plain-v verbosity How much troubleshooting info to print-w Print out results in HTML tables-i Use HEAD instead of GET-x attributes String to insert as table attributes-y attributes String to insert as tr attributes-z attributes String to insert as td or th attributes-C attribute Add cookie, eg. Apache1234. (repeatable)-H attribute Add Arbitrary header line, eg. Accept-Encoding: gzipInserted after all normal header lines. (repeatable)-A attribute Add Basic WWW Authentication, the attributesare a colon separated username and password.-P attribute Add Basic Proxy Authentication, the attributesare a colon separated username and password.-X proxy:port Proxyserver and port number to use-V Print version number and exit-k Use HTTP KeepAlive feature-d Do not show percentiles served table.-S Do not show confidence estimators and warnings.-q Do not show progress when doing more than 150 requests-g filename Output collected data to gnuplot format file.-e filename Output CSV file with percentages served-r Dont exit on socket receive errors.-h Display usage information (this message)-Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers)-f protocol Specify SSL/TLS protocol(SSL3, TLS1, TLS1.1, TLS1.2 or ALL)ab -n一次发送的请求数 -c请求的并发数 访问路径[rootlocalhost ~]# ping 192.168.74.1 PING 192.168.74.1 (192.168.74.1) 56(84) bytes of data. 64 bytes from 192.168.74.1: icmp_seq1 ttl64 time0.582 ms 64 bytes from 192.168.74.1: icmp_seq2 ttl64 time0.427 ms 64 bytes from 192.168.74.1: icmp_seq3 ttl64 time0.342 ms 64 bytes from 192.168.74.1: icmp_seq4 ttl64 time0.370 ms 64 bytes from 192.168.74.1: icmp_seq5 ttl64 time0.426 ms 64 bytes from 192.168.74.1: icmp_seq6 ttl64 time0.548 ms 64 bytes from 192.168.74.1: icmp_seq7 ttl64 time0.791 msredis中的值重新改为0。 [rootlocalhost ~]# ab -n 5000 -c 100 http://192.168.74.1:8500/api/album/albumInfo/test/lock This is ApacheBench, Version 2.3 $Revision: 1430300 $ Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/Benchmarking 192.168.74.1 (be patient) Completed 500 requests Completed 1000 requests Completed 1500 requests Completed 2000 requests Completed 2500 requests Completed 3000 requests Completed 3500 requests Completed 4000 requests Completed 4500 requests Completed 5000 requests Finished 5000 requestsServer Software: Server Hostname: 192.168.74.1 Server Port: 8500Document Path: /api/album/albumInfo/test/lock Document Length: 76 bytesConcurrency Level: 100 Time taken for tests: 5.374 seconds Complete requests: 5000 Failed requests: 593(Connect: 0, Receive: 0, Length: 593, Exceptions: 0) Write errors: 0 Total transferred: 2352965 bytes HTML transferred: 382965 bytes Requests per second: 930.38 [#/sec] (mean) Time per request: 107.483 [ms] (mean) Time per request: 1.075 [ms] (mean, across all concurrent requests) Transfer rate: 427.57 [Kbytes/sec] receivedConnection Times (ms)min mean[/-sd] median max Connect: 1 19 19.7 17 404 Processing: 20 87 65.9 73 542 Waiting: 15 82 65.0 68 538 Total: 36 106 70.3 90 581Percentage of the requests served within a certain time (ms)50% 9066% 10075% 10880% 11590% 13895% 17698% 33099% 534100% 581 (longest request)4.2、查看 redis 中的值 5、添加本地锁 synchronized Overridepublic synchronized void testLock(){Object numObj this.redisTemplate.opsForValue().get(num);if (numObj null) {this.redisTemplate.opsForValue().set(num, 1);return;}Integer num Integer.parseInt(numObj.toString());this.redisTemplate.opsForValue().set(num, num);}redis中的值重新改为0。 重启之后使用ab工具压力测试5000次请求并发100。 [rootlocalhost ~]# ab -n 5000 -c 100 http://192.168.74.1:8500/api/album/albumInfo/test/lock This is ApacheBench, Version 2.3 $Revision: 1430300 $ Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/Benchmarking 192.168.74.1 (be patient) Completed 500 requests Completed 1000 requests Completed 1500 requests Completed 2000 requests Completed 2500 requests Completed 3000 requests Completed 3500 requests Completed 4000 requests Completed 4500 requests Completed 5000 requests Finished 5000 requestsServer Software: Server Hostname: 192.168.74.1 Server Port: 8500Document Path: /api/album/albumInfo/test/lock Document Length: 76 bytesConcurrency Level: 100 Time taken for tests: 23.247 seconds Complete requests: 5000 Failed requests: 746(Connect: 0, Receive: 0, Length: 746, Exceptions: 0) Write errors: 0 Total transferred: 2353730 bytes HTML transferred: 383730 bytes Requests per second: 215.08 [#/sec] (mean) Time per request: 464.933 [ms] (mean) Time per request: 4.649 [ms] (mean, across all concurrent requests) Transfer rate: 98.88 [Kbytes/sec] receivedConnection Times (ms)min mean[/-sd] median max Connect: 0 1 4.1 1 196 Processing: 5 446 365.2 414 2722 Waiting: 4 446 365.2 414 2722 Total: 5 447 365.4 415 2734Percentage of the requests served within a certain time (ms)50% 41566% 54875% 62480% 66490% 75095% 80098% 181999% 2408100% 2734 (longest request)测试完成后查看redis中的值 完美是否真的完美 接下来再看集群情况下会怎样 6、集群情况下问题演示 启动多个运行实例 redis中的值重新改为0。 [rootlocalhost ~]# ab -n 5000 -c 100 http://192.168.74.1:8500/api/album/albumInfo/test/lock This is ApacheBench, Version 2.3 $Revision: 1430300 $ Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/Benchmarking 192.168.74.1 (be patient) Completed 500 requests Completed 1000 requests Completed 1500 requests Completed 2000 requests Completed 2500 requests Completed 3000 requests Completed 3500 requests Completed 4000 requests Completed 4500 requests Completed 5000 requests Finished 5000 requestsServer Software: Server Hostname: 192.168.74.1 Server Port: 8500Document Path: /api/album/albumInfo/test/lock Document Length: 76 bytesConcurrency Level: 100 Time taken for tests: 8.714 seconds Complete requests: 5000 Failed requests: 686(Connect: 0, Receive: 0, Length: 686, Exceptions: 0) Write errors: 0 Total transferred: 2353430 bytes HTML transferred: 383430 bytes Requests per second: 573.79 [#/sec] (mean) Time per request: 174.280 [ms] (mean) Time per request: 1.743 [ms] (mean, across all concurrent requests) Transfer rate: 263.74 [Kbytes/sec] receivedConnection Times (ms)min mean[/-sd] median max Connect: 0 2 3.2 1 54 Processing: 6 170 106.2 164 565 Waiting: 6 170 106.2 163 565 Total: 7 172 106.8 165 568Percentage of the requests served within a certain time (ms)50% 16566% 21875% 24980% 26990% 31795% 35198% 39899% 436100% 568 (longest request)由于这三个运行实例的服务名都是 service-album而网关配置的就是通过服务名负载均衡我们只要通过网关访问网关就会给我们做负载均衡了。 再次执行之前的压力测试查看redis中的值 集群情况下又出问题了 以上测试可以发现 ​ 本地锁只能锁住同一工程内的资源在分布式系统里面都存在局限性。 此时需要分布式锁。。
http://www.dnsts.com.cn/news/87479.html

相关文章:

  • 用qq邮箱做网站乐清网论坛
  • 专业网站是什么意思知名网站开发哪家好
  • 定制网站开发多少钱哪个网站建设平台支持花呗分期
  • 河南网站建设运营域名注册公司网站私信界面
  • 中石油网页设计与网站建设网站建设与管理工作内容
  • 技术支持 网站建设福千欣隆网站建设公司 概况
  • 网站收录有什么用做网站是用什么语言做成的
  • 官方网站旗舰店网络的结构
  • 岳麓 网站设计创建公司网站需要准备哪些素材
  • wordpress主题取消中山市企业网站seo营销工具
  • vps如果制作论坛网站品牌logo设计在线生成
  • 武进建设局网站首页科普网站建设方案
  • 女程序员可以干到多少岁网站营销优化
  • 单页网站模板修改吗发布 php 微网站
  • 满洲里网站建设整站下载器 做网站地图
  • 沛县网站企业网站备案系统
  • 六盘水市网站建设美食网站开发的目标
  • 湖南智能网站建设平台百度爱采购优化排名软件
  • 高平网站优化公司毕业答辩问题怎么做的这个网站
  • 深圳建设管理中心网站正规网站开发流程
  • 英文外贸网站制作外贸网站 流量
  • 做网站要好多钱WordPress添加ftp
  • 建站模板 discuzwordpress注册未发邮件
  • 山东省建设工程注册中心网站群晖wordpress端口无法登陆
  • 洛阳网站建设启辰网络微舍 微网站 怎么做
  • 免费网站建设咨询手工企业网站模板
  • 电子商务网站建设与管理案例如何将网站开发成微信小程序
  • 长春网长春网站建设络推广旺店通app手机企业版下载
  • 枣庄学习建设网站培训徐州英才网最新招聘信息
  • 深圳龙华区住房和建设局网站京东app下载官网免费下载