From 146e40597997b10a25ed2044dea234d6799c87a3 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sun, 12 Jan 2020 12:54:23 -0500 Subject: [PATCH 1/2] Adding image caching via immutable to ansible. #371 #408 --- ansible/templates/nginx.conf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ansible/templates/nginx.conf b/ansible/templates/nginx.conf index 4af5be01c..0a420d777 100644 --- a/ansible/templates/nginx.conf +++ b/ansible/templates/nginx.conf @@ -68,8 +68,7 @@ server { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; if ($request_uri ~ \.(?:ico|gif|jpe?g|png|webp|bmp|mp4)$) { - add_header Cache-Control "public"; - expires max; + add_header Cache-Control "public, max-age=31536000, immutable"; } } } From b79fc265f17ccf9ba1c78a4cf4273941744763a4 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sun, 12 Jan 2020 13:04:13 -0500 Subject: [PATCH 2/2] Adding an apache bench (ab) report. --- server/query_testing/apache_bench_report.sh | 24 +++++++++++++++++++ .../query_testing/generate_explain_reports.sh | 3 +++ 2 files changed, 27 insertions(+) create mode 100755 server/query_testing/apache_bench_report.sh diff --git a/server/query_testing/apache_bench_report.sh b/server/query_testing/apache_bench_report.sh new file mode 100755 index 000000000..95b9a6c4c --- /dev/null +++ b/server/query_testing/apache_bench_report.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +declare -a arr=( +"https://mastodon.social/" +"https://peertube.social/" +"https://dev.lemmy.ml/" +"https://dev.lemmy.ml/feeds/all.xml" +"https://dev.lemmy.ml/.well-known/nodeinfo" +"https://fediverse.blog/.well-known/nodeinfo" +) + +## now loop through the above array +for i in "${arr[@]}" +do + ab -c 10 -t 10 "$i" > out.abtest + grep "Server Hostname:" out.abtest + grep "Document Path:" out.abtest + grep "Requests per second" out.abtest + grep "(mean, across all concurrent requests)" out.abtest + grep "Transfer rate:" out.abtest + echo "---" +done + +rm *.abtest diff --git a/server/query_testing/generate_explain_reports.sh b/server/query_testing/generate_explain_reports.sh index e1a2ff516..40b2bceea 100755 --- a/server/query_testing/generate_explain_reports.sh +++ b/server/query_testing/generate_explain_reports.sh @@ -8,6 +8,9 @@ psql -qAt -U lemmy -f explain.sql > user_view.json echo "explain (analyze, format json) select * from post_view where user_id is null order by hot_rank desc" > explain.sql psql -qAt -U lemmy -f explain.sql > post_view.json +echo "explain (analyze, format json) select * from post" > explain.sql +psql -qAt -U lemmy -f explain.sql > post.json + echo "explain (analyze, format json) select * from comment_view where user_id is null" > explain.sql psql -qAt -U lemmy -f explain.sql > comment_view.json