Fossil

Check-in [0a6d8ff5]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add the fossil-stress.tcl script for stress-testing server implementations.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0a6d8ff505faea06a09b22c894a0cc51eb73d43722c6739a8c051704ac247f12
User & Date: drh 2017-12-28 13:53:07.915
Context
2017-12-28
15:49
Add the "--threads N" option to the fossil-stress.tcl script. Default value is 10. ... (check-in: 08f5fb62 user: drh tags: trunk)
13:53
Add the fossil-stress.tcl script for stress-testing server implementations. ... (check-in: 0a6d8ff5 user: drh tags: trunk)
2017-12-23
04:21
Only show the number of requests on the /test_env page if running on unix from "fossil server" or "fossil ui". ... (check-in: f4a9df4d user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Added tools/fossil-stress.tcl.


































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/tclsh
#
# Run this script, giving the url of a Fossil server instances as the
# argument, and this script will start sending HTTP requests into the
# that server instance as fast as it can, as a stress test for the
# server implementation.
#
set url [lindex $argv 0]
if {$url==""} {
  error "Usage: $argv0 URL"
}
if {![regexp {^https?://([^/:]+)(:\d+)?(/.*)$} $url all domain port path]} {
  error "could not parse the URL [list $url] -- should be of the\
         form \"http://domain/path\""
}
set useragent {Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0}
set path [string trimright $path /]
set port [string trimleft $port :]
if {$port==""} {set port 80}

proc send_one_request {domain port path} {
  set x [socket $domain $port]
  fconfigure $x -translation binary
  puts $x "GET $path HTTP/1.0\r"
  if {$port==80} {
    puts $x "Host: $domain\r"
  } else {
    puts $x "Host: $domain:$port\r"
  }
  puts $x "User-Agent: $::useragent\r"
  puts $x "Accept: text/html,q=0.9,*/*;q=0.8\r"
  puts $x "Accept-Language: en-US,en;q=0.5\r"
  puts $x "Connection: close\r"
  puts $x "\r"
  flush $x
  set cnt 0
  while {![eof $x]} {
    incr cnt [string length [read $x]]
  }
  close $x
  return $cnt
}

set pages {
  /timeline?n=20
  /timeline?n=20&a=1970-01-01
  /home
  /brlist
  /info/trunk
  /info/2015-01-01
  /vdiff?from=2015-01-01&to=trunk&diff=0
  /wcontent
  /fileage
  /dir
  /tree
  /uvlist
  /stat
  /test_env
  /sitemap
  /hash-collisions
  /artifact_stats
  /bloblist
  /bigbloblist
  /wiki_rules
  /md_rules
  /help
  /test-all-help
  /timewarps
  /taglist
}

set cnt 0
while {1} {
  foreach p $pages {
    incr cnt
    puts -nonewline "$cnt: $path$p... "
    flush stdout
    set n [send_one_request $domain $port $path$p]
    puts "$n bytes"
  }
}