Merge lp:~ahasenack/landscape-client/297623-curl-compression into lp:~landscape/landscape-client/trunk

Proposed by Andreas Hasenack
Status: Merged
Approved by: Jamu Kakar
Approved revision: 284
Merged at revision: 312
Proposed branch: lp:~ahasenack/landscape-client/297623-curl-compression
Merge into: lp:~landscape/landscape-client/trunk
Diff against target: 84 lines (+15/-7)
2 files modified
landscape/lib/fetch.py (+1/-0)
landscape/lib/tests/test_fetch.py (+14/-7)
To merge this branch: bzr merge lp:~ahasenack/landscape-client/297623-curl-compression
Reviewer Review Type Date Requested Status
Jamu Kakar (community) Approve
Thomas Herve (community) Approve
Review via email: mp+47029@code.launchpad.net

Description of the change

This branch adds a header to our curl requests saying we support gzip and deflate compression methods. If the server supports them too, then compression can be negotiated.

I don't have many great ideas for testing the effectiveness of this other than firing up two machines, point them to staging and compare the traffic generated by each one of them. One using this branch, and the other not.

We could also change the apache logging to show the compression ratio that was achieved.

If you don't have other ideas, I will go ahead with the above using LDS as a guinea pig.

That being said, I of course already built packages with this branch and pointed them at production and staging, and it worked.

To post a comment you must log in.
Revision history for this message
Thomas Herve (therve) wrote :

Fine with me, +1.

review: Approve
Revision history for this message
Jamu Kakar (jkakar) wrote :

Nice work, +1!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'landscape/lib/fetch.py'
2--- landscape/lib/fetch.py 2010-06-23 16:04:29 +0000
3+++ landscape/lib/fetch.py 2011-01-21 12:21:16 +0000
4@@ -84,6 +84,7 @@
5 curl.setopt(pycurl.NOSIGNAL, 1)
6 curl.setopt(pycurl.WRITEFUNCTION, input.write)
7 curl.setopt(pycurl.DNS_CACHE_TIMEOUT, 0)
8+ curl.setopt(pycurl.ENCODING, "gzip,deflate")
9
10 try:
11 curl.perform()
12
13=== modified file 'landscape/lib/tests/test_fetch.py'
14--- landscape/lib/tests/test_fetch.py 2010-04-28 13:07:53 +0000
15+++ landscape/lib/tests/test_fetch.py 2011-01-21 12:21:16 +0000
16@@ -94,7 +94,8 @@
17 pycurl.LOW_SPEED_TIME: 600,
18 pycurl.NOSIGNAL: 1,
19 pycurl.WRITEFUNCTION: Any(),
20- pycurl.DNS_CACHE_TIMEOUT: 0})
21+ pycurl.DNS_CACHE_TIMEOUT: 0,
22+ pycurl.ENCODING: "gzip,deflate"})
23
24 def test_post(self):
25 curl = CurlStub("result")
26@@ -110,7 +111,8 @@
27 pycurl.NOSIGNAL: 1,
28 pycurl.WRITEFUNCTION: Any(),
29 pycurl.POST: True,
30- pycurl.DNS_CACHE_TIMEOUT: 0})
31+ pycurl.DNS_CACHE_TIMEOUT: 0,
32+ pycurl.ENCODING: "gzip,deflate"})
33
34 def test_post_data(self):
35 curl = CurlStub("result")
36@@ -129,7 +131,8 @@
37 pycurl.POST: True,
38 pycurl.POSTFIELDSIZE: 4,
39 pycurl.READFUNCTION: Any(),
40- pycurl.DNS_CACHE_TIMEOUT: 0})
41+ pycurl.DNS_CACHE_TIMEOUT: 0,
42+ pycurl.ENCODING: "gzip,deflate"})
43
44 def test_cainfo(self):
45 curl = CurlStub("result")
46@@ -145,7 +148,8 @@
47 pycurl.NOSIGNAL: 1,
48 pycurl.WRITEFUNCTION: Any(),
49 pycurl.CAINFO: "cainfo",
50- pycurl.DNS_CACHE_TIMEOUT: 0})
51+ pycurl.DNS_CACHE_TIMEOUT: 0,
52+ pycurl.ENCODING: "gzip,deflate"})
53
54 def test_cainfo_on_http(self):
55 curl = CurlStub("result")
56@@ -168,7 +172,8 @@
57 pycurl.NOSIGNAL: 1,
58 pycurl.WRITEFUNCTION: Any(),
59 pycurl.HTTPHEADER: ["a: 1", "b: 2"],
60- pycurl.DNS_CACHE_TIMEOUT: 0})
61+ pycurl.DNS_CACHE_TIMEOUT: 0,
62+ pycurl.ENCODING: "gzip,deflate"})
63
64 def test_timeouts(self):
65 curl = CurlStub("result")
66@@ -184,7 +189,8 @@
67 pycurl.LOW_SPEED_TIME: 30,
68 pycurl.NOSIGNAL: 1,
69 pycurl.WRITEFUNCTION: Any(),
70- pycurl.DNS_CACHE_TIMEOUT: 0})
71+ pycurl.DNS_CACHE_TIMEOUT: 0,
72+ pycurl.ENCODING: "gzip,deflate"})
73
74 def test_unicode(self):
75 """
76@@ -255,7 +261,8 @@
77 pycurl.LOW_SPEED_TIME: 600,
78 pycurl.NOSIGNAL: 1,
79 pycurl.WRITEFUNCTION: Any(),
80- pycurl.DNS_CACHE_TIMEOUT: 0})
81+ pycurl.DNS_CACHE_TIMEOUT: 0,
82+ pycurl.ENCODING: "gzip,deflate"})
83 finally:
84 pycurl.Curl = Curl
85

Subscribers

People subscribed via source and target branches

to all changes: