Add new performance measurements.

This commit is contained in:
kristapsdz committed 2015-08-06 19:35:18 +00:00
1 parent 7b8e5300b2
commit a417d49d50
16 files changed
+33355 -582

No files matched your search

+8 -6
View File
@@ -197,14 +197,13 @@ REGRESS_SRCS = regress/regress.c \
regress/test-upload.c
SVGS = figure1.svg \
figure2.png \
figure3.png \
figure4.svg
all: kfcgi libkcgi.a libkcgihtml.a libkcgijson.a libkcgixml.a libkcgiregress.a
afl: $(AFL)
samples: all sample sample-fcgi
samples: all sample sample-fcgi sample-cgi
regress: $(REGRESS)
@for f in $(REGRESS) ; do \
@@ -320,10 +319,10 @@ config.h: config.h.pre config.h.post configure $(TESTS)
rm -f config.log
CC="$(CC)" CFLAGS="$(CFLAGS)" ./configure
installcgi: sample sample-fcgi
installcgi: sample sample-fcgi sample-cgi
install -m 0755 sample $(PREFIX)/sample.cgi
install -m 0755 sample-cgi $(PREFIX)/sample-simple.cgi
install -m 0755 sample-fcgi $(PREFIX)/sample-fcgi.cgi
install -m 0755 sample sample-fcgi $(PREFIX)
install -m 0444 template.xml $(PREFIX)
install: all
@@ -336,7 +335,7 @@ install: all
install -m 0444 kcgi.h kcgihtml.h kcgijson.h kcgixml.h $(DESTDIR)$(INCLUDEDIR)
install -m 0444 $(MAN3S) $(DESTDIR)$(MAN3DIR)
install -m 0444 $(MAN8S) $(DESTDIR)$(MAN8DIR)
install -m 0444 template.xml sample.c sample-fcgi.c $(DESTDIR)$(DATADIR)
install -m 0444 template.xml sample.c sample-fcgi.c sample-cgi.c $(DESTDIR)$(DATADIR)
rm -f kcgi.h~
sample: sample.o libkcgi.a libkcgihtml.a
@@ -345,6 +344,9 @@ sample: sample.o libkcgi.a libkcgihtml.a
sample-fcgi: sample-fcgi.o libkcgi.a
$(CC) -o $@ $(STATIC) sample-fcgi.o -L. libkcgi.a -lz
sample-cgi: sample-cgi.o
$(CC) -o $@ $(STATIC) sample-cgi.o
www: $(SVGS) index.html kcgi.tgz kcgi.tgz.sha512 $(HTMLS) $(TUTORIALHTMLS)
installwww: www
@@ -400,7 +402,7 @@ kcgi.tgz:
gnuplot $<
clean:
rm -f kcgi.tgz kcgi.tgz.sha512 $(SVGS) $(HTMLS) sample sample-fcgi sample.o sample-fcgi.o kfcgi kfcgi.o
rm -f kcgi.tgz kcgi.tgz.sha512 $(SVGS) $(HTMLS) sample sample-fcgi sample.o sample-fcgi.o kfcgi kfcgi.o sample-cgi sample-cgi.o
rm -f index.html $(TUTORIALHTMLS)
rm -f libkcgi.a $(LIBOBJS) $(LIBCONFIGOBJS)
rm -f libkcgihtml.a kcgihtml.o
File diff suppressed because it is too large. Load diff
+4157
View File
File diff suppressed because it is too large. Load diff
+10319
View File
File diff suppressed because it is too large. Load diff
+13603
View File
File diff suppressed because it is too large. Load diff
+17 -9
View File
@@ -15,13 +15,21 @@ set tics nomirror out scale 0.75
set style line 12 lc rgb'#808080' lt 0 lw 1
set grid back ls 12
#########################################################
set key bottom right
set xlabel 'milliseconds'
set size 0.8,0.8
set key outside right
set ytics 0.25
unset title
plot 'perf-time-openbsd-base.dat' u 2:($1/100) w l lw 3 ti '(1)', \
'perf-time-openbsd-base-cgi.dat' u 2:($1/100) w l lw 3 ti '(2)', \
'perf-time-openbsd-kcgi-nosandbox.dat' u 2:($1/100) w l lw 3 ti '(3)', \
'perf-time-openbsd-kcgi-nocompress.dat' u 2:($1/100) w l lw 3 ti '(4)', \
'perf-time-openbsd-kcgi.dat' u 2:($1/100) w l lw 3 ti '(5)'
set datafile separator '\t'
stats 'figure2-cgi.tsv' u 5 nooutput
nr1=STATS_records
stats 'figure2-fcgi.tsv' u 5 nooutput
nr2=STATS_records
stats 'figure2-static.tsv' u 5 nooutput
nr3=STATS_records
stats 'figure2-cgi-naked.tsv' u 5 nooutput
nr4=STATS_records
set xrange [0:60]
plot 'figure2-static.tsv' u 5:(1.0/nr3) s cum lw 4 ti 'static', \
'figure2-cgi.tsv' u 5:(1.0/nr1) s cum lw 4 ti 'CGI', \
'figure2-cgi-naked.tsv' u 5:(1.0/nr4) s cum lw 4 ti 'CGI (simple)', \
'figure2-fcgi.tsv' u 5:(1.0/nr2) s cum lw 4 ti 'FastCGI'
-29
View File
@@ -1,29 +0,0 @@
#!/usr/local/bin/gnuplot
set terminal pngcairo crop enhanced font "Times,15"
set output 'figure3.png'
set border linewidth 1.5
set style line 1 lc rgb '#800000' lt 1 lw 2
set style line 2 lc rgb '#ff0000' lt 1 lw 2
set style line 3 lc rgb '#ff4500' lt 1 lw 2
set style line 4 lc rgb '#ffa500' lt 1 lw 2
set style line 5 lc rgb '#006400' lt 1 lw 2
set style line 6 lc rgb '#0000ff' lt 1 lw 2
set style line 7 lc rgb '#9400d3' lt 1 lw 2
set style line 11 lc rgb '#808080' lt 1
set border 19 back ls 11
set tics nomirror out scale 0.75
set style line 12 lc rgb'#808080' lt 0 lw 1
set grid back ls 12
#########################################################
set size 0.8,0.8
set ylabel "ms"
set xtics rotate by -45
set style fill solid border -1
set xtics ("static" 4, "slowcgi(8)" 3, "kcgi(3)" 2, "no sandbox" 1, "no compress" 0)
plot '-' w hist title ''
2.947
2.481
2.916
1.864
0.22
e
+1 -1
View File
@@ -84,7 +84,7 @@ body > header nav li >div > div { margin-top: 0.5em; }
#longnews,
#comments { max-height: 0; }
#nolongnews,
#nocomments { max-height: 100em; }
#nocomments { max-height: 500em; }
pre.prettyprint { border: none;
line-height: 150%;
margin: 0;
+18 -30
View File
@@ -18,11 +18,11 @@
console.log('maxheight = ' + show.style.maxHeight);
if (show.style.maxHeight == '' || show.style.maxHeight == '0px') {
show.style.maxHeight = '100em';
show.style.maxHeight = '500em';
noshow.style.maxHeight = 0;
} else {
show.style.maxHeight = 0;
noshow.style.maxHeight = '100em';
noshow.style.maxHeight = '500em';
}
}
</script>
@@ -334,42 +334,30 @@ int main(void) {
Performance
</h2>
<p>
Security comes at a price.
Security comes at a price&#8212;but not a stiff price.
By design, <span class="nm">kcgi</span> incurs overhead in three ways: first, spawning a child to
process the untrusted network data; second, enacting the sandbox framework; and third, passing parsed
pairs back to the parent context.
In the case of running CGI scripts, <span class="nm">kcgi</span> performance is bound to the operating
system's ability to spawn and reap processes.
For FastCGI, the bottleneck becomes the transfer of data.
In the following graph, I graph the responsiveness of <span class="nm">kcgi</span> against the baseline
web-server performance.
</p>
<figure>
<img src="figure2.png" />
</figure>
<p>
This figure illustrates the cost of running <span class="nm">kcgi</span> against a baseline on OpenBSD
5.5 running <a href="http://nginx.org">nginx</a> and <a
href="http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man8/slowcgi.8">slowcgi(8)</a>, i386.
It shows the empirical cumulative distribution of a statisically-significant number of page requests
(&gt;1000) as measured by <a href="https://httpd.apache.org/docs/2.2/programs/ab.html">ab(1)</a>.
</p>
<p>
Line (1) shows a static file being served by the web server.
The high speed is due to the file (most likely) being cached by the web server and/or kernel.
Moving right, line (2) shows a basic CGI request producing no content.
The CGI simply exits with an HTTP 200.
This reflects the cost of invoking <a
href="http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man8/slowcgi.8">slowcgi(8)</a>.
Line (3) is a simple <span class="nm">kcgi</span> that simply emits an HTTP 200.
This instance is neither sandboxed nor does it compress output.
The overhead from line (2) is due to the additional child being spawned.
Line (4) shows the addition of sandboxing without compression, in this case via
<a href="http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man4/systrace.4">systrace(4)</a>.
Lastly, line (5) shows both compression and sandboxing.
</p>
<figure>
<img src="figure3.png" />
</figure>
<p>
In this bar chart, I show the same but for relative comparison of the distribution means.
The similarity between the compressed and non-compressed versions are due to the small amount of data
being transmitted in the response body.
This shows the empirical cumulative distribution of a statisically-significant number of page requests
as measured by <a href="https://httpd.apache.org/docs/2.2/programs/ab.html">ab(1)</a> with 10 concurrent
requests.
The <strong>CGI</strong> line is the CGI sample included in the source;
the <strong>FastCGI</strong> line is the FastCGI sample;
the <strong>CGI (simple)</strong> simply emits a 200 HTTP status and <q>Hello, World</q>; and
the <strong>static</strong> is a small static file on the web server.
The operating system is Mac OS X 10.7.5 <q>Air</q> laptop (1.86 GHz Intel Core 2 Duo, 2 GB RAM) with the
stock Apache.
The FastCGI server was started using the <a href="kfcgi.8.html">kfcgi(8)</a> defaults.
</p>
</section>
</article>
-101
View File
@@ -1,101 +0,0 @@
# Percentage served Time in ms
0 1.754
1 1.782
2 1.787
3 1.789
4 1.793
5 1.795
6 1.798
7 1.801
8 1.802
9 1.806
10 1.808
11 1.811
12 1.812
13 1.813
14 1.815
15 1.817
16 1.819
17 1.820
18 1.821
19 1.823
20 1.824
21 1.826
22 1.827
23 1.828
24 1.829
25 1.830
26 1.830
27 1.831
28 1.832
29 1.833
30 1.834
31 1.835
32 1.836
33 1.837
34 1.839
35 1.841
36 1.842
37 1.843
38 1.845
39 1.846
40 1.847
41 1.848
42 1.850
43 1.851
44 1.853
45 1.855
46 1.857
47 1.859
48 1.861
49 1.863
50 1.864
51 1.867
52 1.869
53 1.871
54 1.872
55 1.875
56 1.879
57 1.881
58 1.882
59 1.886
60 1.888
61 1.891
62 1.892
63 1.895
64 1.897
65 1.899
66 1.901
67 1.902
68 1.904
69 1.905
70 1.907
71 1.910
72 1.911
73 1.916
74 1.917
75 1.920
76 1.923
77 1.924
78 1.926
79 1.929
80 1.931
81 1.932
82 1.933
83 1.935
84 1.937
85 1.939
86 1.940
87 1.943
88 1.945
89 1.949
90 1.953
91 1.956
92 1.960
93 1.964
94 1.967
95 1.971
96 1.975
97 1.981
98 1.990
99 2.009
-101
View File
@@ -1,101 +0,0 @@
# Percentage served Time in ms
0 0.215
1 0.217
2 0.217
3 0.218
4 0.218
5 0.218
6 0.218
7 0.218
8 0.218
9 0.218
10 0.218
11 0.218
12 0.218
13 0.218
14 0.219
15 0.219
16 0.219
17 0.219
18 0.219
19 0.219
20 0.219
21 0.219
22 0.219
23 0.219
24 0.219
25 0.219
26 0.219
27 0.219
28 0.219
29 0.219
30 0.219
31 0.219
32 0.219
33 0.219
34 0.219
35 0.219
36 0.219
37 0.220
38 0.220
39 0.220
40 0.220
41 0.220
42 0.220
43 0.220
44 0.220
45 0.220
46 0.220
47 0.220
48 0.220
49 0.220
50 0.220
51 0.220
52 0.220
53 0.220
54 0.220
55 0.220
56 0.220
57 0.220
58 0.220
59 0.220
60 0.221
61 0.221
62 0.221
63 0.221
64 0.221
65 0.221
66 0.221
67 0.221
68 0.221
69 0.221
70 0.222
71 0.222
72 0.222
73 0.223
74 0.223
75 0.223
76 0.223
77 0.224
78 0.224
79 0.224
80 0.225
81 0.225
82 0.226
83 0.226
84 0.227
85 0.228
86 0.230
87 0.233
88 0.234
89 0.235
90 0.237
91 0.239
92 0.240
93 0.241
94 0.245
95 0.253
96 0.255
97 0.256
98 0.265
99 0.296
-101
View File
@@ -1,101 +0,0 @@
# Percentage served Time in ms
0 2.764
1 2.826
2 2.836
3 2.844
4 2.849
5 2.853
6 2.857
7 2.860
8 2.863
9 2.867
10 2.869
11 2.870
12 2.872
13 2.875
14 2.876
15 2.877
16 2.879
17 2.881
18 2.883
19 2.886
20 2.888
21 2.889
22 2.890
23 2.892
24 2.894
25 2.897
26 2.899
27 2.900
28 2.901
29 2.902
30 2.906
31 2.906
32 2.908
33 2.911
34 2.913
35 2.915
36 2.918
37 2.920
38 2.922
39 2.924
40 2.927
41 2.929
42 2.931
43 2.934
44 2.936
45 2.938
46 2.939
47 2.942
48 2.944
49 2.945
50 2.947
51 2.949
52 2.951
53 2.952
54 2.955
55 2.957
56 2.959
57 2.961
58 2.963
59 2.964
60 2.968
61 2.970
62 2.972
63 2.974
64 2.975
65 2.977
66 2.978
67 2.980
68 2.981
69 2.982
70 2.984
71 2.986
72 2.987
73 2.990
74 2.991
75 2.992
76 2.994
77 2.995
78 2.997
79 3.000
80 3.002
81 3.004
82 3.005
83 3.007
84 3.009
85 3.011
86 3.013
87 3.015
88 3.017
89 3.020
90 3.023
91 3.024
92 3.028
93 3.029
94 3.035
95 3.039
96 3.042
97 3.048
98 3.054
99 3.084
-101
View File
@@ -1,101 +0,0 @@
# Percentage served Time in ms
0 2.292
1 2.325
2 2.345
3 2.365
4 2.373
5 2.380
6 2.385
7 2.391
8 2.393
9 2.395
10 2.397
11 2.399
12 2.402
13 2.404
14 2.408
15 2.411
16 2.412
17 2.415
18 2.417
19 2.419
20 2.423
21 2.425
22 2.426
23 2.428
24 2.430
25 2.432
26 2.433
27 2.434
28 2.437
29 2.438
30 2.439
31 2.441
32 2.442
33 2.443
34 2.445
35 2.447
36 2.449
37 2.452
38 2.454
39 2.455
40 2.457
41 2.459
42 2.461
43 2.464
44 2.465
45 2.467
46 2.471
47 2.473
48 2.477
49 2.480
50 2.481
51 2.484
52 2.486
53 2.489
54 2.490
55 2.493
56 2.495
57 2.498
58 2.500
59 2.501
60 2.504
61 2.506
62 2.508
63 2.510
64 2.512
65 2.516
66 2.518
67 2.520
68 2.522
69 2.523
70 2.525
71 2.527
72 2.528
73 2.529
74 2.531
75 2.534
76 2.535
77 2.537
78 2.538
79 2.540
80 2.542
81 2.544
82 2.547
83 2.549
84 2.551
85 2.553
86 2.556
87 2.558
88 2.561
89 2.563
90 2.566
91 2.569
92 2.572
93 2.575
94 2.579
95 2.584
96 2.589
97 2.598
98 2.605
99 2.629
-101
View File
@@ -1,101 +0,0 @@
# Percentage served Time in ms
0 2.768
1 2.797
2 2.808
3 2.814
4 2.818
5 2.822
6 2.824
7 2.826
8 2.828
9 2.830
10 2.832
11 2.834
12 2.836
13 2.840
14 2.843
15 2.845
16 2.847
17 2.849
18 2.852
19 2.853
20 2.855
21 2.856
22 2.857
23 2.859
24 2.861
25 2.862
26 2.865
27 2.866
28 2.867
29 2.868
30 2.870
31 2.872
32 2.875
33 2.876
34 2.879
35 2.880
36 2.883
37 2.885
38 2.887
39 2.889
40 2.891
41 2.893
42 2.896
43 2.899
44 2.903
45 2.905
46 2.907
47 2.909
48 2.911
49 2.914
50 2.916
51 2.917
52 2.919
53 2.921
54 2.922
55 2.924
56 2.926
57 2.928
58 2.930
59 2.932
60 2.934
61 2.936
62 2.938
63 2.941
64 2.942
65 2.944
66 2.944
67 2.946
68 2.948
69 2.949
70 2.951
71 2.953
72 2.955
73 2.956
74 2.959
75 2.960
76 2.962
77 2.963
78 2.964
79 2.966
80 2.968
81 2.971
82 2.973
83 2.975
84 2.977
85 2.979
86 2.982
87 2.984
88 2.986
89 2.989
90 2.990
91 2.993
92 2.996
93 2.999
94 3.005
95 3.010
96 3.016
97 3.026
98 3.035
99 3.063
+13
View File
@@ -0,0 +1,13 @@
#include <stdlib.h>
#include <stdio.h>
int
main(void)
{
printf("Status: 200 OK\r\n");
printf("Content-Type: text/html\r\n");
printf("\r\n");
printf("Hello, world.\n");
return(EXIT_SUCCESS);
}
+7 -2
View File
@@ -2,11 +2,16 @@
<header>
<h1>0.6.5</h1>
<address>Kristaps Dzonsons</address>
<time datetime="2015-08-01">2015-08-01</time>
<time datetime="2015-08-06">2015-08-06</time>
</header>
<aside>
<div>
Implement the FastCGI control socket's sandbox for all supported operating systems.
Implement the <a href="http://www.fastcgi.com/drupal/node/6?q=node/22">FastCGI</a> control process's sandbox for all
supported operating systems.
(The FastCGI control process is forked from each application process, and is responsible for accepting new FastCGI
connections and passing the descriptors to the application for output and worker process for parsing.)
This is the last <q>feature</q> for the FastCGI implementation: it now has the same protection as the CGI implementation
for all child processes.
</div>
</aside>
</article>