并发测试代码
require "net/http" require "uri" term = Time.now uri = URI.parse("http://192.168.1.113/spd/") cnt = 0 1000.times do |i| Thread.new(uri) do |uri| # cnt = cnt + 1 # p cnt http = Net::HTTP.new(uri.host, uri.port) http.request(Net::HTTP::Get.new(uri.request_uri)) end end # p 'sleeping' # sleep 3 printf("time: %1.3fsec\n", Time.now - term)
相关推荐
RocketJ 2020-05-31
luanyu 2020-02-18
abdstime 2020-01-17
abdstime 2020-01-14
goodby 2020-01-05
疯狂紫萧 2019-12-31
jocleyn 2019-12-23
Henryztong 2019-12-21
我是程序员 2010-11-03
Christsam 2019-09-07
mohanzb 2015-10-08
Testingba工作室 2015-09-28
Testingba工作室 2015-01-16
wooodyhuang 2013-03-12
智能的世界 2019-07-14
chenhualeguan 2013-10-16
bxqybxqy 2012-10-16