Skip to content

Commit 126ad97

Browse files
authored
Merge pull request #152 from wchaws/dev2
Dev2
2 parents a244e86 + 0dcea28 commit 126ad97

File tree

4 files changed

+58
-2
lines changed

4 files changed

+58
-2
lines changed

source/constructs/lib/ecs-image-handler.ts

+2
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ function getOrCreateVpc(scope: Construct): ec2.IVpc {
168168
vpcFromLookup.publicSubnets.forEach((subnet) => {
169169
publicSubnetIds.push(subnet.subnetId);
170170
});
171+
// TODO: Try to use vpcFromLookup instead
171172
const vpc = ec2.Vpc.fromVpcAttributes(scope, 'VpcFromAttributes', {
172173
availabilityZones: vpcFromLookup.availabilityZones,
173174
vpcId: vpcFromLookup.vpcId,
@@ -181,6 +182,7 @@ function getOrCreateVpc(scope: Construct): ec2.IVpc {
181182

182183
function getTaskSubnets(scope: Construct, vpc: ec2.IVpc): ec2.ISubnet[] {
183184
const subnetIds: string[] = scope.node.tryGetContext('subnet_ids');
185+
// TODO: use filter subnets from vpc
184186
let subnets: ec2.ISubnet[] = [];
185187
if (subnetIds) {
186188
subnetIds.forEach((subnetId, index) => {
+10-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
# Benchmark test
22

3-
## curl.sh make http requests to urls in parallel
3+
## curl.sh: make http requests to urls in parallel
44

55
```
66
# edit urls.txt
77
88
$ ./curl.sh urls.txt
99
$ N=10 ./curl.sh urls.txt # make 10 http requests simultaneously
10+
```
11+
12+
## vegeta: http load test tools
13+
14+
install https://github.com/tsenart/vegeta firstly
15+
16+
```
17+
# edit vegeta-urls.txt
18+
cat vegeta-urls.txt | vegeta attack -duration=1m -rate=300 -timeout=300s -format=http | vegeta report
1019
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GET http://<HOST>/example.jpg?x-oss-process=image/resize,s_300/quality,q_80/auto-orient,0/interlace,1/format,jpg

source/new-image-handler/test/e2e/mkhtml.py

+45-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,48 @@
2323
</html>
2424
'''
2525
PATHS = [
26+
# resize
27+
'example.jpg?x-oss-process=image/resize,w_100',
28+
'example.jpg?x-oss-process=image/resize,h_50',
29+
'example.jpg?x-oss-process=image/resize,w_100,m_lfit',
30+
'example.jpg?x-oss-process=image/resize,w_100,m_mfit',
31+
'example.jpg?x-oss-process=image/resize,w_100,h_67,m_fill',
32+
'example.jpg?x-oss-process=image/resize,w_100,m_pad',
33+
'example.jpg?x-oss-process=image/resize,h_100,w_100,m_fixed',
34+
'example.jpg?x-oss-process=image/resize,h_100,m_lfit',
35+
'example.jpg?x-oss-process=image/resize,l_100',
36+
'example.jpg?x-oss-process=image/resize,m_fixed,h_100,w_100',
37+
'example.jpg?x-oss-process=image/resize,m_fill,h_100,w_100',
38+
'example.jpg?x-oss-process=image/resize,m_pad,h_100,w_100,color_FF0000',
39+
'example.jpg?x-oss-process=image/resize,p_50',
40+
# circle
41+
'example.jpg?x-oss-process=image/circle,r_100',
42+
# crop
43+
'example.jpg?x-oss-process=image/crop,x_100,y_50',
44+
'example.jpg?x-oss-process=image/crop,x_100,y_50,w_100,h_100',
45+
'example.jpg?x-oss-process=image/crop,x_10,y_10,w_200,h_200,g_se',
46+
# indexcrop
47+
'example.jpg?x-oss-process=image/indexcrop,x_100,i_0',
48+
# rounded-corners
49+
'example.jpg?x-oss-process=image/rounded-corners,r_30',
50+
'example.jpg?x-oss-process=image/crop,w_100,h_100/rounded-corners,r_10/format,png',
51+
# rotate
52+
'example.jpg?x-oss-process=image/rotate,70',
53+
# blur
54+
'example.jpg?x-oss-process=image/blur,r_3,s_2',
55+
# bright
56+
'example.jpg?x-oss-process=image/bright,50',
57+
'example.jpg?x-oss-process=image/bright,-50',
58+
# sharpen
59+
'example.jpg?x-oss-process=image/sharpen,100',
60+
# contrast
61+
'example.jpg?x-oss-process=image/contrast,-50',
62+
'example.jpg?x-oss-process=image/contrast,50',
63+
# quality
64+
'example.jpg?x-oss-process=image/resize,w_100/quality,q_30',
65+
'example.jpg?x-oss-process=image/resize,w_100/quality,Q_30',
66+
# interlace
67+
'example.jpg?x-oss-process=image/resize,w_200/interlace,1',
2668
# watermark
2769
'example.jpg?x-oss-process=image/watermark,text_SGVsbG8gV29ybGQ',
2870
'example.jpg?x-oss-process=image/watermark,text_SGVsbG8gV29ybGQ,g_nw',
@@ -62,7 +104,9 @@ def row(i, a, b):
62104
])
63105

64106

65-
s = TEMPLATE.format(body='\n'.join([row(i, EP_A + p, EP_B + p) for i, p in enumerate(PATHS)]))
107+
s = TEMPLATE.format(body='\n'.join([
108+
row(i, os.path.join(EP_A, p), os.path.join(EP_B, p)) for i, p in enumerate(PATHS)
109+
]))
66110
fname = 'index.html'
67111

68112
with open(fname, 'w') as fp:

0 commit comments

Comments
 (0)