Skip to content

Commit 5f38be9

Browse files
excelle08facebook-github-bot
authored andcommitted
Report zero in DjangoBench and Mediawiki if too many failed requests; reduce verbosity in DjangoBench uwsgi log (#141)
Summary: Pull Request resolved: #141 - Report zero RPS and score if too many failed requests in Mediawiki (<95% availability) and DjangoBench (<99% availability). - Reduce verbosity to django-uwsgi.log in DjangoBench, do not log bundle tray latency unless in debug mode. Reviewed By: meteorfox Differential Revision: D77031945 fbshipit-source-id: 4b14adeaba2a7fabb664422079a8649ef3f2ba14
1 parent 3c6feef commit 5f38be9

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

benchpress/plugins/parsers/django_workload.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ class DjangoWorkloadParser(Parser):
7979
Full Siege output is available in /tmp/siege_out_[N]
8080
"""
8181

82+
DJANGO_MIN_AVAILABILITY = 99
83+
8284
def parse_dw_data(self, data, metric):
8385
"""Helper method to handle errors when extracting metrics and values"""
8486

@@ -139,6 +141,9 @@ def parse(self, stdout, stderr, returncode):
139141
self.parse_dw_key_val(dw_line, dw_metrics)
140142

141143
if "Transaction rate_trans/sec" in dw_metrics:
144+
if dw_metrics["Availability_%"] < self.DJANGO_MIN_AVAILABILITY:
145+
dw_metrics["error"] = "Too many unsuccessful requests"
146+
dw_metrics["Transaction rate_trans/sec"] = 0
142147
rps = dw_metrics["Transaction rate_trans/sec"]
143148
dw_metrics["score"] = float(rps) / DJANGO_BASELINE
144149

benchpress/plugins/parsers/mediawiki.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,28 @@
1414

1515

1616
class MediawikiParser(JSONParser):
17+
MEDIAWIKI_MIN_AVAILABILITY = 0.95
18+
1719
def parse(self, stdout, stderr, returncode):
1820
metrics = super().parse(stdout, stderr, returncode)
1921
if "Combined" in metrics:
22+
nginx_hits = metrics["Combined"]["Nginx hits"]
23+
nginx_200 = metrics["Combined"]["Nginx 200"]
24+
availability = nginx_200 / nginx_hits
25+
is_good_run = True
26+
if availability < self.MEDIAWIKI_MIN_AVAILABILITY:
27+
metrics["error"] = (
28+
f"Too many unsuccessful requests, availability was {100 * availability:.2f}%"
29+
)
30+
is_good_run = False
2031
if "Siege RPS" in metrics["Combined"]:
32+
if not is_good_run:
33+
metrics["Combined"]["Siege RPS"] = 0
2134
rps = metrics["Combined"]["Siege RPS"]
2235
metrics["score"] = float(rps) / MEDIAWIKI_MLP_BASELINE
2336
elif "Wrk RPS" in metrics["Combined"]:
37+
if not is_good_run:
38+
metrics["Combined"]["Wrk RPS"] = 0
2439
rps = metrics["Combined"]["Wrk RPS"]
2540
metrics["score"] = float(rps) / MEDIAWIKI_MLP_BASELINE
2641
return metrics

packages/django_workload/templates/0003-bundle_tray_caching.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ index 36cf90b..7d0cba8 100644
3333
- BundleEntryModel.objects
3434
- .filter(userid__in=self.request.user.following).limit(10))
3535
+ BundleEntryModel.objects.filter(userid__in=self.request.user.following).limit(10))
36-
+ logger.warning('[perf] bundle_tray::bundle_entry.objects.filter: {}'.format(time.time() - start_time))
36+
+ logger.debug('[perf] bundle_tray::bundle_entry.objects.filter: {}'.format(time.time() - start_time))
3737
+
3838
+
3939
# only one bundle per user
@@ -61,7 +61,7 @@ index 36cf90b..7d0cba8 100644
6161
+ for user in UserModel.objects.filter(id__in=list(userids)):
6262
+ userinfo[user.id] = user.json_data
6363
+ cache.set_many(userinfo, 60 * 5)
64-
+ logger.warning('[perf] bundle_tray::user_model.objects.filter: {}'.format(time.time() - start_time))
64+
+ logger.debug('[perf] bundle_tray::user_model.objects.filter: {}'.format(time.time() - start_time))
6565
+
6666
# fetch entry information
6767
feedentryinfo = {}
@@ -98,7 +98,7 @@ index 36cf90b..7d0cba8 100644
9898
}
9999
for b in bundles if b.id in first_bundleids
100100
]}
101-
+ logger.warning('[perf] bundle_tray::feed_entry.objects.filter+bundle_process: {}'.format(time.time() - start_time))
101+
+ logger.debug('[perf] bundle_tray::feed_entry.objects.filter+bundle_process: {}'.format(time.time() - start_time))
102102
return result
103103

104104
def dup_sort_data(self, bundle_list, conf):

0 commit comments

Comments
 (0)