This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script for loadtesting a server with https://github.com/tsenart/vegeta | |
# | |
# Sample output. The server under test breaks down at 10k queries per second: | |
# its error rate goes from 0% to 23%, its 99th latency percentile goes | |
# from 0.488 milliseconds (at 1000 qps) to 71.18 ms (at 10000 qps). | |
# | |
# qps errors 50th 95th 99th | |
# 1000 0.0 0.182 0.222 0.488 | |
# 2000 0.0 0.144 0.224 0.431 | |
# 3000 0.0 0.141 0.244 0.466 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re, requests | |
def _query(query): | |
r = requests.post('https://query.wikidata.org/sparql', | |
params={'query': query}, | |
headers={'Accept': 'text/tab-separated-values'}) | |
return r.text.splitlines() | |
_entity_re = re.compile(r'^<http://www.wikidata.org/entity/([A-Z]\d+)>$') |