DNN-7153 -Changes report

advertisement
DNN-7153: URLRewriter - SiteUrls.config efficiency
The re-write rules in “SiteUrls.config” file are loaded and cached in memory. But fot reach request that is checked for re-write, these rules are
iterated over, a new Regex is created for each rule, and a match test is performed. These rules rarely change and a lot of time is wasted in these
regular expressions.
I modified the code to lazy create these regular expressions and re-use them in each successive call. This process saved about 20% on average
per request. The tables below show this. The test performed against a page from the re-write rules <domain>/DesktopDefault.aspx in Platform
8.0.0.220 installation.
Test results before changes – 1 user x 1000 requests per user repeated 3 times.
Request
HTTP Request
HTTP Request
HTTP Request
Page
1000
1000
1000
Std.
Avg.
Average Min
Max
Dev.
Error
Throughput KB /sec Bytes
49
43
116
4
0.00%
20.3
424.7
21464
49
44
67
3
0.00%
19.9
417.2
21464
50
44
141
5
0.00%
19.7
413.9
21464
Test results before changes – 10 users * 100 requests per user repeated 3 times.
Request
HTTP Request
HTTP Request
HTTP Request
Page
1000
1000
1000
Std.
Avg.
Average Min
Max
Dev.
Error
Throughput KB /sec Bytes
127
46
552
51
0.00%
69.4
1453.8
21464
127
47
474
50
0.00%
68.1
1427.1
21464
122
47
395
38
0.00%
73.2
1534.6
21464
Test results after changes – 1 user x 1000 requests per user repeated 3 times.
Request
HTTP Request
HTTP Request
HTTP Request
Page
1000
1000
1000
Std.
Avg.
Average Min
Max
Dev.
Error
Throughput KB /sec Bytes
41
35
184
5
0.00%
23.9
501.2
21464
40
35
60
3
0.00%
24.5
513.8
21464
40
35
60
3
0.00%
24.5
513.8
21464
Test results before changes – 10 users * 100 requests per user repeated 3 times.
Request
HTTP Request
HTTP Request
HTTP Request
Page
1000
1000
1000
Std.
Avg.
Average Min
Max
Dev.
Error
Throughput KB /sec Bytes
103
34
403
43
0.00%
89.3
1871.3
21464
104
40
627
44
0.00%
84
1761.4
21464
103
40
347
40
0.00%
79.7
1670.9
21464
The following tables show the tests for accessing the Home page of the site with and without the changes in the source code. This also shows a
gain of about 20% in page response time.
Test results before changes – 1 user x 1000 requests per user repeated 1 time.
Request
HTTP Request
Page
1000
Std.
Avg.
Average Min
Max
Dev.
Error
Throughput KB /sec
Bytes
49
42
127
40
0.00%
20.1 420.4262
21407
Test results before changes – 10 users * 100 requests per user repeated 1 time.
Request
HTTP Request
Page
1000
Std.
Avg.
Average Min
Max
Dev.
Error
Throughput KB /sec Bytes
120
46
444
44
0.00%
71
1483.8
21407
Test results after changes – 1 user x 1000 requests per user repeated 1 time.
Request
HTTP Request
Page
1000
Std.
Avg.
Average Min
Max
Dev.
Error
Throughput KB /sec Bytes
41
37
153
40
0.00%
23.8
496.8
21407
Test results before changes – 10 users * 100 requests per user repeated 1 time.
Request
HTTP Request
Page
1000
Std.
Avg.
Average Min
Max
Dev.
Error
Throughput KB /sec Bytes
101
38
321
34
0.00%
84.6
1768.8
21407
As for removing the entries from the “SiteUrls.config” file. I did few tests with and without some entries in the file. These didn’t add much to
time saved and averages were same around the values shown above. Therefore, it is irrelevant whether to remove or keep the entries in this file
at the moment.
Evoq Content 8.2.0.463
I tested using the following:
– 1 user x 1000 requests per user repeated 3 time (total of 3000 requests).
– 10 user x 100 requests per user repeated 3 time (total of 3000 requests).
Test results with original code before making any changes.
Request
Page
Average Min
Std.
Dev.
Max
Error
Throughput KB /sec
Avg.
Bytes
HOME page - 1 user
3000
30
27
67
6
0.0%
20.4
535.0
26907
HOME page - 10 users
3000
63
26
144
15
0.0%
42.2
1108.8
26907
/DesktopDefault.aspx - 1 user (first rule)
3000
31
27
72
7
0.0%
13.2
345.7
26905
/DesktopDefault.aspx - 10 users (first rule)
3000
63
26
128
15
0.0%
27.7
726.7
26905
/DesktopDefault.aspx - 1 user (last rule)
3000
49
42
100
10
0.0%
16.2
425.5
26969
/DesktopDefault.aspx - 10 users (last rule)
3000
96
41
173
18
0.0%
41.6
1095.6
26969
Test results with after optimizing the code related to the configuration file.
Request
Page
Average Min
Std.
Dev.
Max
Error
Throughput KB /sec
Avg.
Bytes
HOME page - 1 user
3000
30
26
75
7
0.0%
17.1
449.3
26907
HOME page - 10 users
3000
63
26
127
16
0.0%
111.5
2929.3
26907
/DesktopDefault.aspx - 1 user (first rule)
3000
30
26
66
6
0.0%
24.8
652.5
26905
/DesktopDefault.aspx - 10 users (first rule)
3000
64
26
130
/DesktopDefault.aspx - 1 user (last rule)
3000
30
27
65
15
6
0.0%
0.0%
29.1
30.3
763.5
796.9
26905
26905
/DesktopDefault.aspx - 10 users (last rule)
3000
63
26
121
14
0.0%
107.6
2827.3
26905
Notice that the HOME page has no difference for a single user or 10 concurrent users in either case (original or optimized code). Also, note that
the page with a re-write rule is slower than the HOME page in the original code, and the response time depends on the location of the rule in the
“SiteUrls.config” file – the further down in the file the rule is, the slower the response time becomes.
In the optimized code, we notice no change in response time for the HOME page. But for the pages with a re-write rule there is an improvement
regarding the position of the rule in the file – it became independent of the location of the rule in the file. So this optimization is helping these
rules that are further down in the configuration file.
Download