-
Notifications
You must be signed in to change notification settings - Fork 6
/
readme
167 lines (111 loc) · 9.97 KB
/
readme
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
Fix up the static cache
-app.config["memcache"] = [ ("127.0.0.1", 11211) ]
-#app.static_cached("www","/path/to/www")
-
-#@app.on('at_start')
-#async def setup():
- #app.c = asyncmrq.Client()
- #await app.c.connect(servers=[("127.0.0.1",7100)])
-
[email protected]('/',_type='text',options=['cache'])
Updating version:
setup.py
src/mrhttp/__init__.py
internals app.c and response.c
sudo sh -c "echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor"
sudo sh -c "echo powersave | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor"
wrk -t4 -c32 -d2s http://localhost:8080/
sudo apt-get install build-essential libssl-dev git -y
git clone https://github.com/wg/wrk.git
cd wrk; make
sudo cp wrk /usr/local/bin
ctest/blog/fast_str -- try AVX2 or tfw's
CFLAGS='-Wall -O0 -g' sudo python setup.py build
CFLAGS='-Wall -O0 -g' python setup.py install --force
PYTHONMALLOC=malloc heapusage -o ~/z python3-dbg site.py
Testing
memcached -l 127.0.0.1 -p 11211 -d -m 50
memcached -l 127.0.0.1 -p 11212 -d -m 50
gdb python3
attach to child process
Memory issues: TODO AddressSanitizer false positives on the ranges* see if I can ignore
CFLAGS='-Wall -O0 -g -fsanitize=address -fno-omit-frame-pointer -fsanitize-recover=address' python setup.py install --force
ASAN_OPTIONS=halt_on_error=0 LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/13/libasan.so python tst.py
Telnet and send partial / bad requests
<<<
GET / HTTP/1.1
Host: localhost:8080
User-Agent: curl/7.51.0
Accept: */*
GET / HTTP/1.1
Host: localhost:8080
User-Agent: curl/7.51.0
Accept: */*
<<<
POST /form HTTP/1.1
Host: localhost:8080
User-Agent: python-requests/2.31.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Content-Length: 19
Content-Type: application/x-www-form-urlencoded
p1=v1¶m2=value2POST /form HTTP/1.1
Host: localhost:8080
User-Agent: python-requests/2.31.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Content-Length: 19
Content-Type: application/x-www-form-urlencoded
p1=v1¶m2=value2
<<<
curl http://localhost:8080/
Valgrind doesn't work with AVX2 ...
valgrind --tool=memcheck --suppressions=valgrind-python.supp python3 -E -tt ./tst.py
Big headers
curl http://localhost:8080/ -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) Gecko/20130501 Firefox/30.0 AppleWebKit/600.00 Chrome/30.0.0000.0 Trident/10.0 Safari/600.00' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' -H 'Cookie: mrsession=43709dd361cc443e976b05714581a7fb; foo=fdsfdasdfasdfdsfasdfsdfsdfasdfas; short=fazc;' -H 'Connection: keep-alive'
FORM urlencoded TODO more params. Can we fix the performance here?
curl -d "param1=value1¶m2=value2" -X POST http://localhost:8080/form -H "Content-Type: application/x-www-form-urlencoded"
wrk -t1 -c1 -d1s http://localhost:8080/form -s tests/lua/form.lua
cookie test:
curl --cookie "mrsession=bnwg23LQbOmdAtcBELdLwsFcyJkN8iGp" http://localhost:8080/
curl -i --raw http://localhost:8080/printCookies -H "Cookie: mrsession=43709dd361cc443e976b05714581a7fb; foo=fdsfdasdfasdfdsfasdfsdfsdfasdfas; short=fazc;"
wrk -t4 -c32 -d1s http://localhost:8080/printCookies -H "Cookie: mrsession=43709dd361cc443e976b05714581a7fb; foo=fdsfdasdfasdfdsfasdfsdfsdfasdfas; short=fazc;"
JSON post:
curl -H "Content-Type: application/json" -X POST -d '{"username":"xyz","password":"xyz"}' http://localhost:8080/
curl -H "Content-Type: application/json" -X POST -d '[1,2,3,4,5,6,7,8,9]' http://localhost:8080/printPostBody
curl -H "Content-Type: application/json" -X POST -d '{"name":"MalthusianProphet","tl":2004,"dankmemes":true,"list":[1,2,3,4,5,6]}' http://localhost:8080/json
wrk -t4 -c32 -d1s http://localhost:8080/json -s tests/lua/json.lua
wrk -t4 -c32 -d1s http://localhost:8080/q/1/2/ -s tests/lua/json.lua
wrk -t4 -c32 -d1s http://localhost:8080/q/1/2/ -s tests/lua/q-pipeline.lua
MRQ test:
curl -i --raw http://localhost:8080/mrq/0 -H "Cookie: mrsession=43709dd361cc443e976b05714581a7fb;" -X POST -d '{"username":"xyz","type":"add"}'
wrk -t4 -c32 -d1s http://localhost:8080/mrq/0 -H "Cookie: mrsession=43709dd361cc443e976b05714581a7fb;" -H "Content-Type: application/mrpacker" -s tests/lua/mrpacker.lua
wrk -t4 -c32 -d1s http://localhost:8080/q/1/2/ -H "Content-Type: application/mrpacker" -s tests/lua/mrpacker.lua
curl -H "Content-Type: application/mrpacker" --data-binary @tests/lua/test.mrp http://localhost:8080/
mrpacker test:
wrk -t4 -c32 -d1s -s tests/lua/mrpacker.lua http://localhost:8080/m
wrk -t4 -c32 -d1s http://localhost:8080/mrpacker -s tests/lua/mrpacker.lua
curl -H "Content-Type: application/mrpacker" --data-binary @tests/lua/test.mrp http://localhost:8080/mrpacker
Session testing
curl -i --raw http://localhost:8080/s -H "Cookie: mrsession=AeeGEVMfFEANKzNPhbNkhMbORHAqn-rR;"
wrk -t4 -c32 -d1s http://localhost:8080/s -H "Cookie: mrsession=AeeGEVMfFEANKzNPhbNkhMbORHAqn-rR;"
File upload:
curl -i -X POST -F "[email protected]" http://localhost:8080/
wrk -t1 -c1 -d1s http://localhost:8080/ -s tests/lua/upload.lua
These are cookies from a couple websites:
wrk -t4 -c32 -d1s http://localhost:8080/ -H "Cookie: last_write=9392597662310--zAhJdToJVGltZQ0ghhyAULskpAo6DW5hbm9fbnVtaQJ8AjoNbmFub19kZW5pBjoNc3VibWljcm8iB2NgOgtvZmZzZXRp%2FoCPOgl6b25lSSIIUFNUBjoGRVQ%3D--b761d36723502350717cef0d7d2e4858732264a2; user_session=zwHPFVsweWHORd6SuaeYcBEhqRW94NEIU0njSybiET7niLkO; __Host-user_session_same_site=ZwHPFVsweWHO234RF6SuaeYcBEhqRWo4NEIU0njSybiET7niLkO; logged_in=yes; dotcom_user=MarkReedZ; _gh_sess=R2I1bjhqdDZ0THNKckJqd3FlcFlRbjNJRUpiU084dU9UbVF4ZC81ZUsxVEgzMmhwSnBkWGR3TExzbmxuWnpoNDNkc1RUVXMr3kJmQ2svVHZBRkxZYkFUeXJIaTNraVV5YVM4anpCWnp4VG1XeD41d1J3Vm92U3laMkVXa1Nta2wySzFzUTZHNFVGMWtsN21Xc3FIQ1hERWF0RllNUUxpSFh6OUZJWS9TUzFzZjRCTjljQ1F3STgvYTA1SHc4O29QOGpEdzC2Y1hMbjlYbEtDU2pQOFJUZCEWmdrTUJtL3hpa3lPb244QVpHN1VjREpIL3pQcjhjZ2xTbVk4cXptODlVNlViWk1EY1l5dmVrQ1BrS2tRRmJYNTkvTjREOGVoV25aNmNBWCtreFM3MWs9LS1uZjBdfslJU1grUEsrOS9EaFpwaFRnPT0%3D--91cb95044f6813e14f1a4420826e27626c8e6666" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "Accept-Language: ja,en-us;q=0.7,en;q=0.3" -H "Accept-Encoding: gzip,deflate" -H "Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.7" -H "Referer: https;//github.com/joyent/http-parser" -H "User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; ja-JP-mac; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3"
wrk -t4 -c32 -d2s http://localhost:8080/ -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "Accept-Language: ja,en-us;q=0.7,en;q=0.3" -H "Accept-Encoding: gzip,deflate" -H "Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.7" -H "Referer: https;//github.com/joyent/http-parser" -H "User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; ja-JP-mac; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3" -H "Cookie: aaaaaaa_recentclicks2=83jfZt9kaa%2C83jfZtbroq%2C83jfZt31c8%2C83jfZt5ds0%2C83jfZt5775; bbbbbbbbb_recentclicks2=83jfZ9dusf%2C83jfZ9ef47%2C83jfZ9e84v%2C83jfZ9e0wm%2C83jfZ9bvs2; __utmc=197362089; ccccccccc_recentclicks2=83jfZlo4tx%2C83jfZlpmql%2C83jfZlplss%2C83jfZlobl3%2C83jfZlpqbw; zzzzzzz_recentclicks2=83jfZsmkhy%2C83jfZsoiom%2C83jfZsk04d%2C83jfZsj7oj%2C83jfZsjm2z; __utmc=55650728; dddddddddd_recentclicks2=83jfZy4kwp%2C83jfZy505s%2C83jfZy5f8a%2C83jfZy5tkn%2C83jfZy6cff; zzzzzfdasfdsaffdas=83jfZz2cl1%2C83jfZz0wrm%2C83jfZz0ruq%2C83jfZz1ggh%2C83jfZz160j; fdsafewfsdfdasf=83jfZc5h0v%2C83jfZc5phb%2C83jfZc65hg%2C83jfZc4oj3%2C83jfZc4x61; fdsafwefwafewae=83jfZrbv3m%2C83jfZrcnql%2C83jfZrd0b2%2C83jfZrcrsl%2C83jfZrd842; _recent_srs=Zs238unr%2CZs22u3ds%2CZs22vcl0%2CZs22qt55%2CZs22qh1s%2CZs22ty1q%2CZs22r090%2CZs23an0q%2CZs22qmij%2CZsZs2f0a; token.sig=712321312fdsafuuQKyzts; loid=1033330004000.2.913610123217.Z0FBQsacUFQHZDc4NnV4RHNielI0STNY82w1X9d2dmJudzU1SFJ0WnhXYzVKWXVWNU8tcGVKeFBGNkZfVjZaTzFQVEUwWEJzdnBrSGJ4UXUzUS1zQjA5ZFppUE1WdXJaejVGMDdqZmN3cXM4UzQwLXN2Yi1kU2lyTHZGNGFWRMVXF0ZlNKdWI; edgebucket=12LeK69QJpCbldsa9rDu; _recent_srs=Zs238unr%2CZs22u3ds%2CZs22vcl0%2CZs22qt55%2CZs22qh1s%2CZs22ty1q%2CZs22r090%2CZs23an0q%2CZs22qmij%2CZs22tf0a; reddit_session=99938527%2C2014-07-12T19%3A45%3A10%2Cda9e9b918e91ed9bccdecc946324d28bd42634950640c; pc=ab; reddaid=TAACADW3Z2WF5G7L3ZQ1; rseor=; rseor2=; rseor3=; aa=1; rabt=; token=823948392eyJAfdsnNFDEZlbiI6InJEeEowaUJCVGotewrf89afDAFS32QktHSSIsInRva2VuVHlwZSI6ImJlYXJlciIsImV4cGlyZXMiOiIyMDE4LTA0LTAyVDEzOjI2OjU4Ljk4OVoiLCJyZWZyZXNoVG9rZW4iOiI0MTIzODUyNy1fVHNwM2xDVjUyUEJZaDhwVjVDVzBXM0kxT0kiLCJzY29wZSI6ImFjY291bnQgY3JlZGRpdHMgZWRpdCBmbGFpciBoaXN0b3J5IGlkZW50aXR5IGxpdmVtYW5hZ2UgbW9kY29uZmlnIG1vZGNvbnRyaWJ1dG9ycyBtb2RmbGFpciBtb2Rsb2cgbW9kbWFpbCBtb2RvdGhlcnMgbW9kcG9zdHMgbW9kc2VsZiBtb2R3aWtpIG15c3VicmVkZGl0cyBwcml2YXRlbWVzc2FnZXMgcmVhZCByZXBvcnQgc2F2ZSBzdHJ1Y3R1cmVkc3R5bGVzIHN1Ym1pdCBzdWJzY3JpYmUgdm90ZSB3aWtpZWRpdCB3aWtpcmVhZCJ9.1; fdsadfdasfdsafasdfds=z3_b8wmjc%2C83jfZby5a7%2C83jfZbcdvx%2C83jfZbcdr1%2C83jfZbcd1n; wpsn=true; fdasfdasfdsafas=Zs238unr%2CZs22vcl0%2CZs238gfm%2CZs22u3ds%2CZs235xig%2CZs232vl0%2CZs22qt55%2CZs23cct3%2CZs22tf0a%2CZs22qh3l; session_tracker=9213u13128uoyUu0f7kt.a.93123123522.Z0FBafdasf3238234llMFDSFamF1Q0Z1V3d0TF9vRFDSMFrewfef4rf4RFDSAFEWFfdsafDSgERVrGdsfdSGtrHdfgHtrdHtSFgdfGSDefdsfas0dnNERlBkWjFDSAFd432gbhotrhgfHGfdhogf2HGfohDFGDFfd1gjfsDGdfsgsSDFgMzEMzJ6THFMNXpPZkFFa1p3MV9mbU0wNFo"
Template testing
curl -d '{"name": "r0fls"}' http://localhost:8080/template
File upload
curl -F "data=@todo" -i --raw http://localhost:8080/f
curl -H "Content-Type: application/json" -X POST -d '{ "name":"MalthusianProphet", "tl":2004, "dankmemes":true "list":[1,2,3,4,5,6] }' http://localhost:8080/json
s_bench:
wrk -t4 -c32 -d1s http://localhost:8080/s -H "Cookie: mrsession=11111111111111111111110000000001;"
wrk -t4 -c32 -d1s http://localhost:8080/mrq/1 -H "Cookie: mrsession=11111111111111111111110000000001;" -s tests/lua/json.lua
wrk -t4 -c32 -d1s http://localhost:8080/mrpackerpy -H "Cookie: mrsession=11111111111111111111110000000001;" -s tests/lua/mrpacker.lua
wrk -t4 -c32 -d1s http://localhost:8080/s -H "Cookie: mrsession=43709dd361cc443e976b05714581a7fb;"
curl -i --raw http://localhost:8080/login
wrk -t4 -c32 -d1s http://localhost:8080/login