verbose: int,
curl_verbose: int,
download_parallel: int = 0,
- server_addr: Optional[str] = None):
+ server_addr: Optional[str] = None,
+ with_dtrace: bool = False):
self.verbose = verbose
self.env = env
self.protocol = protocol
self.server_port = server_port
self._silent_curl = not curl_verbose
self._download_parallel = download_parallel
+ self._with_dtrace = with_dtrace
def info(self, msg):
if self.verbose > 0:
sys.stderr.write(msg)
sys.stderr.flush()
+ def mk_curl_client(self):
+ return CurlClient(env=self.env, silent=self._silent_curl,
+ server_addr=self.server_addr,
+ with_dtrace=self._with_dtrace)
+
def handshakes(self) -> Dict[str, Any]:
props = {}
sample_size = 5
hs_samples = []
errors = []
for _ in range(sample_size):
- curl = CurlClient(env=self.env, silent=self._silent_curl,
- server_addr=self.server_addr)
+ curl = self.mk_curl_client()
args = [
'--http3-only' if self.protocol == 'h3' else '--http2',
f'--{ipv}', f'https://{authority}/'
profiles = []
self.info('single...')
for _ in range(nsamples):
- curl = CurlClient(env=self.env, silent=self._silent_curl,
- server_addr=self.server_addr)
+ curl = self.mk_curl_client()
r = curl.http_download(urls=[url], alpn_proto=self.protocol,
no_save=True, with_headers=False,
with_profile=True)
url = f'{url}?[0-{count - 1}]'
self.info('serial...')
for _ in range(nsamples):
- curl = CurlClient(env=self.env, silent=self._silent_curl,
- server_addr=self.server_addr)
+ curl = self.mk_curl_client()
r = curl.http_download(urls=[url], alpn_proto=self.protocol,
no_save=True,
with_headers=False, with_profile=True)
url = f'{url}?[0-{count - 1}]'
self.info('parallel...')
for _ in range(nsamples):
- curl = CurlClient(env=self.env, silent=self._silent_curl,
- server_addr=self.server_addr)
+ curl = self.mk_curl_client()
r = curl.http_download(urls=[url], alpn_proto=self.protocol,
no_save=True,
with_headers=False,
def downloads(self, count: int, fsizes: List[int], meta: Dict[str, Any]) -> Dict[str, Any]:
nsamples = meta['samples']
max_parallel = self._download_parallel if self._download_parallel > 0 else count
- cols = ['size', 'single']
+ cols = ['size']
+ if not self._download_parallel:
+ cols.append('single')
+ if count > 1:
+ cols.append(f'serial({count})')
if count > 1:
- cols.append(f'serial({count})')
cols.append(f'parallel({count}x{max_parallel})')
rows = []
for fsize in fsizes:
}]
self.info(f'{row[0]["sval"]} downloads...')
url = f'https://{self.env.domain1}:{self.server_port}/score{row[0]["sval"]}.data'
-
- row.append(self.dl_single(url=url, nsamples=nsamples))
+ if 'single' in cols:
+ row.append(self.dl_single(url=url, nsamples=nsamples))
if count > 1:
- row.append(self.dl_serial(url=url, count=count, nsamples=nsamples))
+ if 'single' in cols:
+ row.append(self.dl_serial(url=url, count=count, nsamples=nsamples))
row.append(self.dl_parallel(url=url, count=count, nsamples=nsamples))
rows.append(row)
self.info('done.\n')
profiles = []
self.info('single...')
for _ in range(nsamples):
- curl = CurlClient(env=self.env, silent=self._silent_curl,
- server_addr=self.server_addr)
+ curl = self.mk_curl_client()
r = curl.http_put(urls=[url], fdata=fpath, alpn_proto=self.protocol,
with_headers=False, with_profile=True)
err = self._check_uploads(r, 1)
url = f'{url}?id=[0-{count - 1}]'
self.info('serial...')
for _ in range(nsamples):
- curl = CurlClient(env=self.env, silent=self._silent_curl,
- server_addr=self.server_addr)
+ curl = self.mk_curl_client()
r = curl.http_put(urls=[url], fdata=fpath, alpn_proto=self.protocol,
with_headers=False, with_profile=True)
err = self._check_uploads(r, count)
url = f'{url}?id=[0-{count - 1}]'
self.info('parallel...')
for _ in range(nsamples):
- curl = CurlClient(env=self.env, silent=self._silent_curl,
- server_addr=self.server_addr)
+ curl = self.mk_curl_client()
r = curl.http_put(urls=[url], fdata=fpath, alpn_proto=self.protocol,
with_headers=False, with_profile=True,
extra_args=[
])
self.info(f'{max_parallel}...')
for _ in range(nsamples):
- curl = CurlClient(env=self.env, silent=self._silent_curl,
- server_addr=self.server_addr)
+ curl = self.mk_curl_client()
r = curl.http_download(urls=[url], alpn_proto=self.protocol, no_save=True,
with_headers=False, with_profile=True,
with_stats=False, extra_args=extra_args)
fsize = 10*1024
cols = ['size', 'total']
rows = []
- cols.extend([f'{mp} max' for mp in [1, 6, 25, 50, 100, 300]])
+ mparallel = meta['request_parallels']
+ cols.extend([f'{mp} max' for mp in mparallel])
row = [{
'val': fsize,
'sval': Card.fmt_size(fsize)
self.info('requests, max parallel...')
row.extend([self.do_requests(url=url, count=count,
max_parallel=mp, nsamples=meta["samples"])
- for mp in [1, 6, 25, 50, 100, 300]])
+ for mp in mparallel])
rows.append(row)
self.info('done.\n')
return {
uploads: Optional[List[int]] = None,
upload_count: int = 50,
req_count=5000,
+ request_parallels=None,
nsamples: int = 1,
requests: bool = True):
self.info(f"scoring {self.protocol} against {self.server_descr}\n")
fsizes=uploads,
meta=score['meta'])
if requests:
+ if request_parallels is None:
+ request_parallels = [1, 6, 25, 50, 100, 300]
+ score['meta']['request_parallels'] = request_parallels
score['requests'] = self.requests(count=req_count, meta=score['meta'])
return score
uploads.extend([Card.parse_size(s) for s in x.split(',')])
requests = True
+ request_parallels = None
+ if args.request_parallels:
+ request_parallels = []
+ for x in args.request_parallels:
+ request_parallels.extend([int(s) for s in x.split(',')])
+
+
if args.downloads or args.uploads or args.requests or args.handshakes:
handshakes = args.handshakes
if not args.downloads:
server_port=remote_port,
verbose=args.verbose,
curl_verbose=args.curl_verbose,
- download_parallel=args.download_parallel)
+ download_parallel=args.download_parallel,
+ with_dtrace=args.dtrace)
cards.append(card)
if test_httpd:
server_descr=server_descr,
server_port=server_port,
verbose=args.verbose, curl_verbose=args.curl_verbose,
- download_parallel=args.download_parallel)
+ download_parallel=args.download_parallel,
+ with_dtrace=args.dtrace)
card.setup_resources(server_docs, downloads)
cards.append(card)
server_descr=server_descr,
server_port=server_port,
verbose=args.verbose, curl_verbose=args.curl_verbose,
- download_parallel=args.download_parallel)
+ download_parallel=args.download_parallel,
+ with_dtrace=args.dtrace)
card.setup_resources(server_docs, downloads)
cards.append(card)
upload_count=args.upload_count,
req_count=args.request_count,
requests=requests,
+ request_parallels=request_parallels,
nsamples=args.samples)
if args.json:
print(json.JSONEncoder(indent=2).encode(score))
help="log more output on stderr")
parser.add_argument("-j", "--json", action='store_true',
default=False, help="print json instead of text")
+ parser.add_argument("--samples", action='store', type=int, metavar='number',
+ default=1, help="how many sample runs to make")
+ parser.add_argument("--httpd", action='store_true', default=False,
+ help="evaluate httpd server only")
+ parser.add_argument("--caddy", action='store_true', default=False,
+ help="evaluate caddy server only")
+ parser.add_argument("--curl-verbose", action='store_true',
+ default=False, help="run curl with `-v`")
+ parser.add_argument("--print", type=str, default=None, metavar='filename',
+ help="print the results from a JSON file")
+ parser.add_argument("protocol", default=None, nargs='?',
+ help="Name of protocol to score")
+ parser.add_argument("--start-only", action='store_true', default=False,
+ help="only start the servers")
+ parser.add_argument("--remote", action='store', type=str,
+ default=None, help="score against the remote server at <ip>:<port>")
+ parser.add_argument("--dtrace", action='store_true',
+ default = False, help = "produce dtrace of curl")
+
parser.add_argument("-H", "--handshakes", action='store_true',
default=False, help="evaluate handshakes only")
+
parser.add_argument("-d", "--downloads", action='store_true',
default=False, help="evaluate downloads")
parser.add_argument("--download-sizes", action='append', type=str,
parser.add_argument("--download-count", action='store', type=int,
metavar='number',
default=50, help="perform that many downloads")
- parser.add_argument("--samples", action='store', type=int, metavar='number',
- default=1, help="how many sample runs to make")
parser.add_argument("--download-parallel", action='store', type=int,
metavar='number', default=0,
help="perform that many downloads in parallel (default all)")
+
parser.add_argument("-u", "--uploads", action='store_true',
default=False, help="evaluate uploads")
parser.add_argument("--upload-sizes", action='append', type=str,
parser.add_argument("--upload-count", action='store', type=int,
metavar='number', default=50,
help="perform that many uploads")
+
parser.add_argument("-r", "--requests", action='store_true',
default=False, help="evaluate requests")
parser.add_argument("--request-count", action='store', type=int,
metavar='number',
default=5000, help="perform that many requests")
- parser.add_argument("--httpd", action='store_true', default=False,
- help="evaluate httpd server only")
- parser.add_argument("--caddy", action='store_true', default=False,
- help="evaluate caddy server only")
- parser.add_argument("--curl-verbose", action='store_true',
- default=False, help="run curl with `-v`")
- parser.add_argument("--print", type=str, default=None, metavar='filename',
- help="print the results from a JSON file")
- parser.add_argument("protocol", default=None, nargs='?',
- help="Name of protocol to score")
- parser.add_argument("--start-only", action='store_true', default=False,
- help="only start the servers")
- parser.add_argument("--remote", action='store', type=str,
- default=None, help="score against the remote server at <ip>:<port>")
+ parser.add_argument("--request-parallels", action='append', type=str,
+ metavar='numberlist',
+ default=None, help="evaluate request with these max-parallel numbers")
args = parser.parse_args()
if args.verbose > 0: