Ruby Benchmark Script: Difference between revisions

From Federal Burro of Information
Jump to navigationJump to search
(Created page with " The benchmark script looks like this: <pre> 1 require "net/http" 2 require "uri" 3 4 while true do 5 threads = [] 6 7 5.times do 8 threads << Thread.new do...")
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:
The benchmark script looks like this:
The benchmark script looks like this:


benchmark.rb
<pre>
<pre>
  1 require "net/http"
  1 require "net/http"
Line 20: Line 21:
16 end
16 end
</pre>
</pre>
[[Category:Script]]

Latest revision as of 19:15, 5 November 2022

The benchmark script looks like this:

benchmark.rb

 1 require "net/http"
 2 require "uri"
 3 
 4 while true do
 5   threads = []
 6 
 7   5.times do
 8     threads << Thread.new do
 9       Net::HTTP.get_response(URI.parse("http://172.17.8.102"))
10     end
11   end
12 
13   threads.join
14 
15   sleep rand(2)
16 end