Announce: New http cache plugin

Thanks http.cache definitely improves this for caddy performance. I did quick test with non-HTTPS on virtualbox CentOS 7.3 compared with my Centmin Mod Nginx web server with siege 4.0.2 benchmarks and there is definitely a boost compared to plain caddy. Caddy http.cache had ~30.3% boost in performance (2,458 r/s) compared to normal caddy (1,887 r/s) but still behind Nginx for plain non-cached static html file request (between 3,373-3,605 r/s).

Noticed in http.cache mode, there’s duplicate Server: Caddy headers though ?

  • CentOS 7.3 64bit Virtualbox 4 cpu threads
  • 15.6" Samsung ATIV Book 8 Laptop
  • Intel Core i7 3635QM Quad core (4C/8T)
  • 16GB RAM
  • 960GB Crucial M500 SSD

caddy 0.10.6 default no cache

siege -b -c50 -t30s http://localhost:8888 -m caddy-c50-t30s

caddy 0.10.6 enable http.cache proxy on port 8889 to 8888 backend

siege -b -c50 -t30s http://localhost:8889 -m caddy-http.cache-c50-t30s

centmin mod nginx 1.13.3 with worker_processes 2; default

siege -b -c50 -t30s http://localhost -m cmm-nginx-c50-t30s

centmin mod nginx 1.13.3 with worker_processes auto;

siege -b -c50 -t30s http://localhost -m cmm-nginx-auto-c50-t30s
head -n1 /usr/local/var/log/siege.log; tail -8 /usr/local/var/log/siege.log     
      Date & Time,  Trans,  Elap Time,  Data Trans,  Resp Time,  Trans Rate,  Throughput,  Concurrent,    OKAY,   Failed
**** caddy-c50-t30s ****
2017-08-01 08:51:48,  56611,      30.00,         283,       0.03,     1887.03,        9.43,       49.60,   56611,       0
**** cmm-nginx-c50-t30s ****
2017-08-01 08:52:18, 108095,      29.98,         656,       0.01,     3605.57,       21.88,       49.03,  108095,       0
**** cmm-nginx-auto-c50-t30s ****
2017-08-01 10:57:54, 100516,      29.80,         610,       0.01,     3373.02,       20.47,       49.11,  100516,       0
**** caddy-http.cache-c50-t30s ****
2017-08-01 11:37:11,  71534,      29.10,         358,       0.02,     2458.21,       12.30,       49.42,   71534,       0
curl -I http://localhost:80
HTTP/1.1 200 OK
Date: Tue, 01 Aug 2017 10:51:36 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 3801
Last-Modified: Sun, 30 Jul 2017 04:13:50 GMT
Connection: keep-alive
Vary: Accept-Encoding
ETag: "597d5cfe-ed9"
Server: nginx centminmod
X-Powered-By: centminmod
Accept-Ranges: bytes
curl -I http://localhost:8888
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: max-age=86400
Content-Length: 3801
Content-Type: text/html; charset=utf-8
Etag: "otvyf22xl"
Last-Modified: Sun, 30 Jul 2017 04:13:50 GMT
Server: Caddy
X-Powered-By: Caddy via CentminMod
Date: Tue, 01 Aug 2017 10:51:39 GMT
curl -I http://localhost:8889
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: max-age=86400
Content-Length: 3801
Content-Type: text/html; charset=utf-8
Date: Tue, 01 Aug 2017 11:34:46 GMT
Etag: "otvyf22xl"
Last-Modified: Sun, 30 Jul 2017 04:13:50 GMT
Server: Caddy
Server: Caddy
X-Cache-Status: miss
X-Powered-By: Caddy via CentminMod
curl -I http://localhost:8889
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: max-age=86400
Content-Length: 3801
Content-Type: text/html; charset=utf-8
Date: Tue, 01 Aug 2017 11:34:46 GMT
Etag: "otvyf22xl"
Last-Modified: Sun, 30 Jul 2017 04:13:50 GMT
Server: Caddy
Server: Caddy
X-Cache-Status: hit
X-Powered-By: Caddy via CentminMod
caddy -version
Caddy 0.10.6
caddy -plugins
Server types:
  net
  http

Caddyfile loaders:
  short
  flag
  default

Other plugins:
  http.authz
  http.awslambda
  http.basicauth
  http.bind
  http.browse
  http.cache
  http.cgi
  http.cors
  http.errors
  http.expires
  http.expvar
  http.ext
  http.fastcgi
  http.filemanager
  http.filter
  http.git
  http.gopkg
  http.gzip
  http.header
  http.hugo
  http.index
  http.internal
  http.ipfilter
  http.jwt
  http.limits
  http.log
  http.login
  http.mailout
  http.markdown
  http.mime
  http.minify
  http.nobots
  http.pprof
  http.prometheus
  http.proxy
  http.proxyprotocol
  http.push
  http.ratelimit
  http.realip
  http.reauth
  http.redir
  http.request_id
  http.restic
  http.rewrite
  http.root
  http.status
  http.templates
  http.timeouts
  http.upload
  http.webdav
  http.websocket
  net.host
  shutdown
  startup
  tls
  tls.dns.cloudflare
  tls.dns.digitalocean
  tls.dns.googlecloud
  tls.dns.linode
  tls.dns.namecheap
  tls.dns.ovh
  tls.dns.route53
  tls.dns.vultr
  tls.storage.file

nginx -V
nginx version: nginx/1.13.3
built by clang 3.4.2 (tags/RELEASE_34/dot2-final)
built with LibreSSL 2.5.5
TLS SNI support enabled
configure arguments: --with-ld-opt=‘-lrt -ljemalloc -Wl,-z,relro -Wl,-rpath,/usr/local/lib’ --with-cc-opt=‘-m64 -mtune=native -DTCP_FASTOPEN=23 -g -O3 -fstack-protector -fuse-ld=gold --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wno-sign-compare -Wno-string-plus-int -Wno-deprecated-declarations -Wno-unused-parameter -Wno-unused-const-variable -Wno-conditional-uninitialized -Wno-mismatched-tags -Wno-sometimes-uninitialized -Wno-parentheses-equality -Wno-tautological-compare -Wno-self-assign -Wno-deprecated-register -Wno-deprecated -Wno-invalid-source-encoding -Wno-pointer-sign -Wno-parentheses -Wno-enum-conversion -Wno-c++11-compat-deprecated-writable-strings -Wno-write-strings -gsplit-dwarf’ --sbin-path=/usr/local/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-compat --with-http_stub_status_module --with-http_secure_link_module --with-libatomic --with-http_gzip_static_module --with-http_sub_module --with-http_addition_module --with-http_image_filter_module=dynamic --with-http_geoip_module --with-stream_geoip_module --with-stream_realip_module --with-stream_ssl_preread_module --with-threads --with-stream=dynamic --with-stream_ssl_module --with-http_realip_module --add-dynamic-module=…/ngx-fancyindex-0.4.0 --add-module=…/ngx_cache_purge-2.3 --add-module=…/ngx_devel_kit-0.3.0 --add-module=…/set-misc-nginx-module-0.31 --add-module=…/echo-nginx-module-0.60 --add-module=…/redis2-nginx-module-0.14 --add-module=…/ngx_http_redis-0.3.7 --add-module=…/memc-nginx-module-0.18 --add-module=…/srcache-nginx-module-0.31 --add-module=…/headers-more-nginx-module-0.32 --with-pcre=…/pcre-8.41 --with-pcre-jit --with-zlib=…/zlib-1.2.11 --with-http_ssl_module --with-http_v2_module --with-openssl=…/libressl-2.5.5