Ema has submitted this change and it was merged.

Change subject: varnishlog4: default to request grouping
......................................................................


varnishlog4: default to request grouping

We observed high CPU usage under load when using varnishlog4 without
explicitly specifying a transaction grouping mode.

This patch makes varnishlog4 default to request grouping if no specific
transaction grouping mode has been chosen.

Bug: T137114
Ref: https://www.varnish-cache.org/docs/trunk/reference/vsl-query.html#grouping
Change-Id: Ib1540ff811f4159844cdc1288364ab889b9bff78
---
M modules/varnish/files/varnishlog4.py
1 file changed, 22 insertions(+), 0 deletions(-)

Approvals:
  Ema: Verified; Looks good to me, approved
  BBlack: Looks good to me, but someone else must approve



diff --git a/modules/varnish/files/varnishlog4.py 
b/modules/varnish/files/varnishlog4.py
index 3392ab8..f3fed5d 100755
--- a/modules/varnish/files/varnishlog4.py
+++ b/modules/varnish/files/varnishlog4.py
@@ -21,6 +21,20 @@
         ],
     my_callback)
 
+  By default, varnishlog will group transactions by request. A specific
+  transaction grouping mode can be used to override the default.
+  For example:
+
+    varnishlog(
+        [
+            ('g', 'session'),
+            # ...
+        ],
+    my_callback)
+
+  See https://www.varnish-cache.org/docs/trunk/reference/vsl-query.html for
+  more details.
+
   This module depends on python-varnishapi:
   https://github.com/xcir/python-varnishapi
 
@@ -132,16 +146,24 @@
             [ '-i', 'ReqURL', 'c', '-i', 'ReqMethod' ]"""
     vapi = varnishapi.VarnishAPI()
 
+    grouping = False
     parsed_args = []
     for switch, value in args:
         # eg: switch = "i", value = "ReqUrl"
         if switch == "i" and value not in vapi.VSL_tags_rev:
             raise Exception("Unknown Tag: %s" % value)
 
+        if switch == "g":
+            grouping = True
+
         parsed_args.append("-%s" % switch)
         if value:
             parsed_args.append(value)
 
+    if not grouping:
+        # Use request grouping by default. T137114
+        parsed_args += ["-g", "request"]
+
     return parsed_args
 
 

-- 
To view, visit https://gerrit.wikimedia.org/r/293530
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib1540ff811f4159844cdc1288364ab889b9bff78
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ema <e...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: Elukey <ltosc...@wikimedia.org>
Gerrit-Reviewer: Ema <e...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to