I have:
Server Software: ngx_openresty/1.2.8.6
Server Hostname: 192.168.56.10
Server Port: 80
Document Path: /
Document Length: 11918 bytes
Concurrency Level: 10
Time taken for tests: 2.446 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 12212000 bytes
HTML transferred: 11918000 bytes
Requests per second: 408.80 [#/sec] (mean)
Time per request: 24.462 [ms] (mean)
Time per request: 2.446 [ms] (mean, across all concurrent requests)
Transfer rate: 4875.30 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 3
Processing: 3 24 4.0 23 46
Waiting: 0 24 3.9 23 46
Total: 4 24 3.9 23 46
Percentage of the requests served within a certain time (ms)
50% 23
66% 25
75% 26
80% 27
90% 28
95% 31
98% 34
99% 41
100% 46 (longest request)
And without, yeah faster but how much?
Server Software: ngx_openresty/1.2.8.6
Server Hostname: 192.168.56.10
Server Port: 80
Document Path: /
Document Length: 16401 bytes
Concurrency Level: 10
Time taken for tests: 0.187 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 16695000 bytes
HTML transferred: 16401000 bytes
Requests per second: 5356.62 [#/sec] (mean) That much.Time per request: 1.867 [ms] (mean)
Time per request: 0.187 [ms] (mean, across all concurrent requests)
Transfer rate: 87332.73 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 1
Processing: 0 2 0.6 1 6
Waiting: 0 1 0.7 1 5
Total: 1 2 0.6 2 6
WARNING: The median and mean for the processing time are not within a normal deviation
These results are probably not that reliable.
Percentage of the requests served within a certain time (ms)
50% 2
66% 2
75% 2
80% 2
90% 2
95% 3
98% 3
99% 4
100% 6 (longest request)
So use regexp even from «god of optimization»(agentzh) is very expensive.
And that's why i think, there must be method to use filter before nginx store cache on disk, singletime.(hook proxy_cache?)
I mean call regexp single time on update cache not every request, process cached version.
That i think must save speed of direct cache and flexibility of filters.
P/s Those test very inaccurate just to show difference.
P.p.s Fast(i just image that) and wrong(?) solution i guess is something like:
location = /cached {
proxy_pass http://1k-loud-lods.tk/; #My Test Site
proxy_set_header Accept-Encoding "";
proxy_ignore_headers Expires Cache-Control;
replace_filter '<script\b[^>]*>([\s\S]*?)<\/script>|\s\s+|\t|\n' '' 'ig';
}
location = / {
proxy_pass http://192.168.56.10/cached;#path to itself
proxy_set_header Accept-Encoding "";
proxy_ignore_headers Expires Cache-Control;
proxy_cache STATIC;
proxy_cache_valid 200 302 60m;
proxy_cache_valid 404 1m;
}
And yeah than its store in cache filtered version and bench say 5274.79 [#/sec] (mean) , but its ugly and you can create better solution.:)
Thanks for your time.
Best regards. Viktor.M