title = "Building a Tiny CDN With pyinfra and Chimera Linux"
date = 2024-12-08T10:18:01+10:00
# [extra]
# updated = 2024-07-26T10:34:50+10:00
+++
In my quest to make my [linkedlist.org][linkedlist]—my link blog—faster, I set
up multiple deployments around the world. I used pyinfra to automate the
process and Chimera Linux as the host operating system. Join me on this
adventure in over-engineering to see how I dropped the average response time
across nine global locations from 807ms to 189ms without spending a fortune.
<figureclass="text-center">
<svg
width="93.756485mm"
height="168.49266mm"
style="width: 250px; height: auto;"
viewBox="0 0 93.756485 168.49266"
version="1.1"
id="svg1"
aria-labelledby="title desc"
role="img"
xml:space="preserve"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<title>Network diagram of Linked List infrastructure</title>
<desc>A network diagram showing a user at the top. An arrow from the user points downward to a node labelled Gcore GeoDNS. Three dashed arrows point down from the Gcore node to three servers labelled: AU, FR, and NY. Below the servers at the bottom of the diagram is another smaller server titled Qotom. It has arrows pointing up to each of the other servers with a label over the arrows, "Certs".</desc>
d="M 32,42 C 32,42 18,42 18,38 18,30 34,28 34,22 34,18 23,18 23,18 m 26,4 9,3 V 48 L 44,62 34,56 V 32 Z M 14,2 C 7.37,2 2,7.37 2,14 2,20.61 7.37,26 14,26 20.61,26 26,20.61 26,14 26,7.37 20.61,2 14,2 Z"
id="path3-7" /><linearGradient
id="gradient0-5"
gradientUnits="userSpaceOnUse"
x1="33.689999"
y1="1.88"
x2="51.599998"
y2="3.6700001"><stop
offset="0"
stop-color="#d7d7d7"
id="stop3-3" /><stop
offset="1"
stop-color="#b8b8b8"
id="stop4-5" /></linearGradient><path
style="fill:url(#gradient0-5)"
d="m 44,36 v 26 l -2.13,-1.38 v -10 L 36,48 36.02,57.21 34,56 V 32 Z"
d="M 14,2 C 10.46,2 7.27,3.52 5.07,5.96 5.07,5.96 8,6 8,8 8,10 4,14 4,14 v 2 c 0,0 2,0 4,2 2,2 0,4 0,4 l 2.27,3.41 C 11.44,25.78 12.69,26 14,26 c 2.99,0 5.72,-1.1 7.83,-2.93 L 20,22 22,18 c 0,0 -6,-2 -6,-4 0,-2 4,-6 4,-6 L 18,6 15.87,8 H 14 L 16,6 14,4 17.39,2.48 C 16.31,2.16 15.17,2 14,2 Z"
d="M 5.07,5.96 C 3.16,8.08 2,10.9 2,14 c 0,5.32 3.47,9.84 8.27,11.41 L 8,22 C 8,22 10,20 8,18 6,16 4,16 4,16 V 14 C 4,14 8,10 8,8 8,6 5.07,5.96 5.07,5.96 Z M 14,8 h 2.37 L 18,6 20,8 c 0,0 -4,4 -4,6 0,2 6,4 6,4 l -2,4 1.83,1.07 C 24.38,20.88 26,17.62 26,14 26,8.54 22.36,3.95 17.39,2.48 L 14,4 16,6 Z"
d="m 6,52 20,-14 18,-1 15,4 c 2,1 0,3 0,3 L 43,61 c -1,1 -3.04,1 -3.04,1 H 28 Z"
id="path1-5" /><path
style="fill:none;stroke:#000000;stroke-width:4"
d="M 23,3 7,15 c 0,0 -1,0 -1,2 0,2 0,28 0,28 0,2 1,3 1,3 l 19,10 c 0,0 1,1 3,-1 L 46,39 c 0,0 0,-25 0,-27 0,-2 -1,-2 -1,-2 L 27.1,2.8 C 27.1,2.8 25,1 23,3 Z"
id="path2-0" /><linearGradient
id="gradient0-3"
gradientUnits="userSpaceOnUse"
x1="27.65"
y1="-1.9400001"
x2="51.700001"
y2="19.120001"><stop
offset="0"
stop-color="#cecece"
id="stop2-6" /><stop
offset="1"
stop-color="#acacac"
id="stop3-1" /></linearGradient><path
style="fill:url(#linearGradient51)"
d="m 6,17 c 0,1 0,26 0,28 0,2 1.05,2.52 1.05,2.52 l 19.93,9.97 C 26.98,57.49 28,57 28,56 28,55 28,27 28,25 28,23 26.97,22.57 26.97,22.57 L 7,15 c 0,0 -1,0 -1,2 z"
id="path3-0" /><linearGradient
id="gradient1-6"
gradientUnits="userSpaceOnUse"
x1="48.049999"
y1="-27.809999"
x2="77.269997"
y2="-16.549999"><stop
offset="0"
stop-color="#858585"
id="stop4-3" /><stop
offset="1"
stop-color="#bababa"
id="stop5-2" /></linearGradient><path
style="fill:url(#linearGradient52)"
d="M 28,25 V 57 L 46,39 V 11 Z"
id="path5-0" /><linearGradient
id="gradient2-61"
gradientUnits="userSpaceOnUse"
x1="31.91"
y1="46.25"
x2="4.4099998"
y2="34.93"><stop
offset="0"
stop-color="#c3c3c3"
id="stop6-5" /><stop
offset="1"
stop-color="#fffcf9"
id="stop7-5" /></linearGradient><path
style="fill:url(#linearGradient53)"
d="M 25,2 7,15 27,23 45,10 Z"
id="path7-4" /><path
style="fill:#000000"
d="m 18,20 v 2 c 0,0 4,1 4,4 0,1 0,29 0,29 l 5,2 V 26 c 0,-2 -1,-2 -1,-2 z"
d="m 6,52 20,-14 18,-1 15,4 c 2,1 0,3 0,3 L 43,61 c -1,1 -3.04,1 -3.04,1 H 28 Z"
id="path16" /><path
style="fill:none;stroke:#000000;stroke-width:4"
d="M 23,3 7,15 c 0,0 -1,0 -1,2 0,2 0,28 0,28 0,2 1,3 1,3 l 19,10 c 0,0 1,1 3,-1 L 46,39 c 0,0 0,-25 0,-27 0,-2 -1,-2 -1,-2 L 27.1,2.8 C 27.1,2.8 25,1 23,3 Z"
id="path17" /><linearGradient
id="linearGradient20"
gradientUnits="userSpaceOnUse"
x1="27.65"
y1="-1.9400001"
x2="51.700001"
y2="19.120001"><stop
offset="0"
stop-color="#cecece"
id="stop19" /><stop
offset="1"
stop-color="#acacac"
id="stop20" /></linearGradient><path
style="fill:url(#linearGradient31)"
d="m 6,17 c 0,1 0,26 0,28 0,2 1.05,2.52 1.05,2.52 l 19.93,9.97 C 26.98,57.49 28,57 28,56 28,55 28,27 28,25 28,23 26.97,22.57 26.97,22.57 L 7,15 c 0,0 -1,0 -1,2 z"
id="path20" /><linearGradient
id="linearGradient22"
gradientUnits="userSpaceOnUse"
x1="48.049999"
y1="-27.809999"
x2="77.269997"
y2="-16.549999"><stop
offset="0"
stop-color="#858585"
id="stop21" /><stop
offset="1"
stop-color="#bababa"
id="stop22" /></linearGradient><path
style="fill:url(#linearGradient32)"
d="M 28,25 V 57 L 46,39 V 11 Z"
id="path22" /><linearGradient
id="linearGradient24"
gradientUnits="userSpaceOnUse"
x1="31.91"
y1="46.25"
x2="4.4099998"
y2="34.93"><stop
offset="0"
stop-color="#c3c3c3"
id="stop23" /><stop
offset="1"
stop-color="#fffcf9"
id="stop24" /></linearGradient><path
style="fill:url(#linearGradient33)"
d="M 25,2 7,15 27,23 45,10 Z"
id="path24" /><path
style="fill:#000000"
d="m 18,20 v 2 c 0,0 4,1 4,4 0,1 0,29 0,29 l 5,2 V 26 c 0,-2 -1,-2 -1,-2 z"
d="m 6,52 20,-14 18,-1 15,4 c 2,1 0,3 0,3 L 43,61 c -1,1 -3.04,1 -3.04,1 H 28 Z"
id="path34" /><path
style="fill:none;stroke:#000000;stroke-width:4"
d="M 23,3 7,15 c 0,0 -1,0 -1,2 0,2 0,28 0,28 0,2 1,3 1,3 l 19,10 c 0,0 1,1 3,-1 L 46,39 c 0,0 0,-25 0,-27 0,-2 -1,-2 -1,-2 L 27.1,2.8 C 27.1,2.8 25,1 23,3 Z"
id="path35" /><linearGradient
id="linearGradient36"
gradientUnits="userSpaceOnUse"
x1="27.65"
y1="-1.9400001"
x2="51.700001"
y2="19.120001"><stop
offset="0"
stop-color="#cecece"
id="stop35" /><stop
offset="1"
stop-color="#acacac"
id="stop36" /></linearGradient><path
style="fill:url(#linearGradient47)"
d="m 6,17 c 0,1 0,26 0,28 0,2 1.05,2.52 1.05,2.52 l 19.93,9.97 C 26.98,57.49 28,57 28,56 28,55 28,27 28,25 28,23 26.97,22.57 26.97,22.57 L 7,15 c 0,0 -1,0 -1,2 z"
id="path36" /><linearGradient
id="linearGradient38"
gradientUnits="userSpaceOnUse"
x1="48.049999"
y1="-27.809999"
x2="77.269997"
y2="-16.549999"><stop
offset="0"
stop-color="#858585"
id="stop37" /><stop
offset="1"
stop-color="#bababa"
id="stop38" /></linearGradient><path
style="fill:url(#linearGradient48)"
d="M 28,25 V 57 L 46,39 V 11 Z"
id="path38" /><linearGradient
id="linearGradient40"
gradientUnits="userSpaceOnUse"
x1="31.91"
y1="46.25"
x2="4.4099998"
y2="34.93"><stop
offset="0"
stop-color="#c3c3c3"
id="stop39" /><stop
offset="1"
stop-color="#fffcf9"
id="stop40" /></linearGradient><path
style="fill:url(#linearGradient49)"
d="M 25,2 7,15 27,23 45,10 Z"
id="path40" /><path
style="fill:#000000"
d="m 18,20 v 2 c 0,0 4,1 4,4 0,1 0,29 0,29 l 5,2 V 26 c 0,-2 -1,-2 -1,-2 z"
style="font-weight:600;font-size:5.29167px;font-family:'Work Sans';-inkscape-font-specification:'Work Sans Semi-Bold'"
d="m 67.490102,130.96066 h -0.756709 l -0.291042,-0.85196 h -1.338792 l -0.291042,0.85196 h -0.746125 l 1.275292,-3.4925 h 0.873126 z m -2.222501,-1.39171 h 1.010709 l -0.508001,-1.524 z m 5.52429,-2.10079 v 2.11667 q 0,0.71437 -0.381,1.07421 -0.381,0.35454 -1.11125,0.35454 -0.730251,0 -1.111251,-0.35454 -0.381,-0.35984 -0.381,-1.07421 v -2.11667 h 0.73025 v 2.08492 q 0,0.43921 0.185209,0.65087 0.1905,0.21167 0.576792,0.21167 0.386291,0 0.5715,-0.21167 0.185208,-0.21166 0.185208,-0.65087 v -2.08492 z"
id="text54"
aria-label="AU" /><path
style="font-weight:600;font-size:5.29167px;font-family:'Work Sans';-inkscape-font-specification:'Work Sans Semi-Bold'"
d="m 104.48671,128.08199 h -1.88383 v 0.88901 h 1.48695 v 0.58737 h -1.48695 v 1.42875 h -0.73025 v -3.4925 h 2.61408 z m 2.16429,-0.58737 q 0.59267,0 0.93133,0.28575 0.33867,0.28575 0.33867,0.76729 0,0.51329 -0.33867,0.78846 -0.33866,0.26988 -0.92604,0.26988 l -0.0741,0.0423 h -0.75142 v 1.33879 h -0.71967 v -3.4925 z m -0.0847,1.59808 q 0.30692,0 0.45509,-0.1217 0.15346,-0.127 0.15346,-0.3863 0,-0.25929 -0.15346,-0.381 -0.14817,-0.127 -0.45509,-0.127 h -0.73554 v 1.016 z m 0.42863,0.15346 1.13242,1.74096 h -0.82021 l -0.93663,-1.52929 z"
id="text55"
aria-label="FR" /><path
style="font-weight:600;font-size:5.29167px;font-family:'Work Sans';-inkscape-font-specification:'Work Sans Semi-Bold'"
d="m 138.23485,127.49462 v 3.4925 h -0.83608 l -1.22238,-2.05317 -0.30163,-0.5715 h -0.005 l 0.0212,0.60325 v 2.02142 h -0.65617 v -3.4925 h 0.83079 l 1.22238,2.04788 0.30163,0.57679 h 0.0106 l -0.0212,-0.60325 v -2.02142 z m 3.71475,0 -1.23825,2.18546 v 1.30704 h -0.73025 v -1.30704 l -1.23825,-2.18546 h 0.77788 l 0.56091,1.04775 0.26459,0.54504 0.26987,-0.54504 0.56092,-1.04775 z"
id="text56"
aria-label="NY" /><path
style="font-weight:600;font-size:5.29167px;font-family:'Work Sans';-inkscape-font-specification:'Work Sans Semi-Bold'"
d="m 99.119839,182.28596 q -0.3175,0 -0.576792,-0.11112 -0.254,-0.10583 -0.402167,-0.33867 -0.148167,-0.23283 -0.148167,-0.59266 0,-0.0847 0.01588,-0.17992 0.02117,-0.0952 0.0635,-0.18521 l 0.47625,-0.0741 q -0.03704,0.0952 -0.05821,0.17462 -0.01587,0.0741 -0.01587,0.13759 0,0.24341 0.08996,0.37041 0.08996,0.127 0.238125,0.17463 0.148166,0.0476 0.328083,0.0476 0.216959,0 0.370417,-0.0529 0.15875,-0.0476 0.264584,-0.13759 l 0.132291,0.54504 q -0.132291,0.10584 -0.354542,0.16405 -0.216958,0.0582 -0.423333,0.0582 z m -0.867834,-4.60375 q 0.518584,0 0.894292,0.21696 0.375709,0.21696 0.576792,0.61913 0.206375,0.40216 0.206375,0.96308 0,0.56092 -0.206375,0.96308 -0.201083,0.40217 -0.576792,0.61913 -0.375708,0.21696 -0.894292,0.21696 -0.518584,0 -0.899584,-0.21696 -0.375708,-0.21696 -0.582084,-0.61913 -0.201083,-0.40216 -0.201083,-0.96308 0,-0.56092 0.201083,-0.96308 0.206376,-0.40217 0.582084,-0.61913 0.381,-0.21696 0.899584,-0.21696 z m 0,0.59796 q -0.296334,0 -0.502709,0.13758 -0.206375,0.13759 -0.3175,0.40746 -0.105833,0.26459 -0.105833,0.65617 0,0.38629 0.105833,0.65617 0.111125,0.26987 0.3175,0.40746 0.206375,0.13758 0.502709,0.13758 0.291042,0 0.497417,-0.13758 0.206375,-0.13759 0.312208,-0.40746 0.111126,-0.26988 0.111126,-0.65617 0,-0.39158 -0.111126,-0.65617 -0.105833,-0.26987 -0.312208,-0.40746 -0.206375,-0.13758 -0.497417,-0.13758 z m 3.545415,0.24871 q 0.40217,0 0.70379,0.16404 0.30692,0.16404 0.47625,0.47096 0.17463,0.30692 0.17463,0.74083 0,0.42863 -0.17463,0.74084 -0.16933,0.30691 -0.47625,0.47096 -0.30162,0.16404 -0.70379,0.16404 -0.39688,0 -0.70379,-0.16404 -0.30692,-0.16405 -0.48154,-0.47096 -0.16934,-0.31221 -0.16934,-0.74084 0,-0.43391 0.16934,-0.74083 0.17462,-0.30692 0.48154,-0.47096 0.30691,-0.16404 0.70379,-0.16404 z m 0,0.53975 q -0.20108,0 -0.34396,0.0952 -0.13758,0.09 -0.21167,0.27517 -0.0741,0.1852 -0.0741,0.46566 0,0.28046 0.0741,0.46567 0.0741,0.18521 0.21167,0.28046 0.14288,0.09 0.34396,0.09 0.19579,0 0.33337,-0.09 0.14288,-0.0952 0.21696,-0.28046 0.0741,-0.18521 0.0741,-0.46567 0,-0.28046 -0.0741,-0.46566 -0.0741,-0.18521 -0.21696,-0.27517 -0.13758,-0.0952 -0.33337,-0.0952 z m 2.87031,-1.29646 v 2.59292 q 0,0.1905 0.0952,0.28046 0.10054,0.0847 0.26987,0.0847 0.13229,0 0.23284,-0.037 0.10054,-0.0423 0.17991,-0.11112 l 0.11642,0.48154 q -0.127,0.10054 -0.3175,0.15875 -0.1905,0.0582 -0.40217,0.0582 -0.26458,0 -0.47096,-0.0794 -0.20108,-0.0794 -0.3175,-0.254 -0.11112,-0.17462 -0.11112,-0.46566 v -2.50826 z m 0.84666,0.80963 v 0.53975 h -2.05846 v -0.53975 z m 1.69863,-0.0529 q 0.40217,0 0.70379,0.16404 0.30692,0.16404 0.47625,0.47096 0.17463,0.30692 0.17463,0.74083 0,0.42863 -0.17463,0.74084 -0.16933,0.30691 -0.47625,0.47096 -0.30162,0.16404 -0.70379,0.16404 -0.39687,0 -0.70379,-0.16404 -0.30692,-0.16405 -0.48154,-0.47096 -0.16933,-0.31221 -0.16933,-0.74084 0,-0.43391 0.16933,-0.74083 0.17462,-0.30692 0.48154,-0.47096 0.30692,-0.16404 0.70379,-0.16404 z m 0,0.53975 q -0.20108,0 -0.34396,0.0952 -0.13758,0.09 -0.21166,0.27517 -0.0741,0.1852 -0.0741,0.46566 0,0.28046 0.0741,0.46567 0.0741,0.18521 0.21166,0.28046 0.14288,0.09 0.34396,0.09 0.19579,0 0.33338,-0.09 0.14287,-0.0952 0.21696,-0.28046 0.0741,-0.18521 0.0741,-0.46567 0,-0.28046 -0.0741,-0.46566 -0.0741,-0.18521 -0.21696,-0.27517 -0.13759,-0.0952 -0.33338,-0.0952 z m 1.96322,2.159 v -2.64583 h 0.65087 l 0.0265,0.47625 q 0.13229,-0.26459 0.35983,-0.39688 0.23284,-0.13229 0.5133,-0.13229 0.28575,0 0.51329,0.13229 0.23283,0.13229 0.34925,0.39158 0.0847,-0.17462 0.22754,-0.29104 0.14288,-0.11641 0.3175,-0.17462 0.17463,-0.0582 0.35454,-0.0582 0.25929,0 0.47096,0.10583 0.21696,0.10584 0.34396,0.3175 0.127,0.21167 0.127,0.53975 v 1.73567 h -0.72496 v -1.59279 q 0,-0.29104 -0.127,-0.41275 -0.127,-0.12171 -0.32808,-0.12171 -0.15875,0 -0.29634,0.0794 -0.13229,0.0794 -0.21166,0.23813 -0.0741,0.15346 -0.0741,0.38629 v 1.42346 h -0.72496 v -1.59279 q 0,-0.29104 -0.13229,-0.41275 -0.127,-0.12171 -0.32808,-0.12171 -0.13758,0 -0.27517,0.0741 -0.13229,0.0741 -0.22225,0.23284 -0.0847,0.15875 -0.0847,0.41804 v 1.40229 z"
id="text58"
aria-label="Qotom" /><path
style="font-weight:600;font-size:5.29167px;font-family:'Work Sans';-inkscape-font-specification:'Work Sans Semi-Bold'"
d="m 121.1676,72.850387 q -0.48154,0 -0.84667,-0.211667 -0.35983,-0.211667 -0.56092,-0.613834 -0.20108,-0.402167 -0.20108,-0.968375 0,-0.560917 0.21167,-0.963084 0.21166,-0.407459 0.59796,-0.624417 0.39158,-0.216959 0.90487,-0.216959 0.56621,0 0.91546,0.211667 0.34925,0.206375 0.55563,0.645584 l -0.67734,0.291042 q -0.0847,-0.280459 -0.29104,-0.412751 -0.20108,-0.137583 -0.49742,-0.137583 -0.29633,0 -0.51329,0.142875 -0.21696,0.137583 -0.33337,0.407459 -0.11642,0.264583 -0.11642,0.650875 0,0.396875 0.11113,0.672042 0.11112,0.269875 0.32808,0.407459 0.22225,0.132291 0.54504,0.132291 0.17463,0 0.32279,-0.04233 0.15346,-0.04233 0.26459,-0.127 0.11112,-0.08467 0.17462,-0.216958 0.0635,-0.132292 0.0635,-0.306917 v -0.07937 h -0.91546 v -0.534459 h 1.54517 v 1.841501 h -0.51329 l -0.0529,-0.762 0.127,0.08996 q -0.11642,0.34925 -0.41275,0.53975 -0.29104,0.185209 -0.73554,0.185209 z m 3.51896,-2.751669 q 0.35454,0 0.59796,0.105834 0.2487,0.100542 0.39687,0.280458 0.15346,0.174625 0.21696,0.391584 l -0.67733,0.243417 q -0.0529,-0.238125 -0.17992,-0.359834 -0.127,-0.121708 -0.34396,-0.121708 -0.20108,0 -0.34396,0.09525 -0.14287,0.08996 -0.21696,0.280458 -0.0741,0.185209 -0.0741,0.465667 0,0.280459 0.0741,0.465667 0.0794,0.185209 0.22225,0.275167 0.14817,0.08996 0.34396,0.08996 0.15875,0 0.26988,-0.05292 0.11112,-0.05821 0.17991,-0.164042 0.0741,-0.105833 0.10055,-0.254 l 0.65616,0.211667 q -0.0582,0.238125 -0.21696,0.418042 -0.15875,0.179916 -0.40745,0.280458 -0.24871,0.100542 -0.5768,0.100542 -0.40745,0 -0.71966,-0.164042 -0.31221,-0.164042 -0.48155,-0.470959 -0.16933,-0.306916 -0.16933,-0.740833 0,-0.433917 0.16933,-0.740834 0.16934,-0.306917 0.47626,-0.470959 0.30691,-0.164042 0.70379,-0.164042 z m 2.98979,0 q 0.40216,0 0.70379,0.164042 0.30692,0.164042 0.47625,0.470959 0.17462,0.306917 0.17462,0.740834 0,0.428625 -0.17462,0.740833 -0.16933,0.306917 -0.47625,0.470959 -0.30163,0.164042 -0.70379,0.164042 -0.39688,0 -0.7038,-0.164042 -0.30691,-0.164042 -0.48154,-0.470959 -0.16933,-0.312208 -0.16933,-0.740833 0,-0.433917 0.16933,-0.740834 0.17463,-0.306917 0.48154,-0.470959 0.30692,-0.164042 0.7038,-0.164042 z m 0,0.539751 q -0.20109,0 -0.34396,0.09525 -0.13759,0.08996 -0.21167,0.275167 -0.0741,0.185208 -0.0741,0.465667 0,0.280458 0.0741,0.465667 0.0741,0.185208 0.21167,0.280458 0.14287,0.08996 0.34396,0.08996 0.19579,0 0.33337,-0.08996 0.14288,-0.09525 0.21696,-0.280458 0.0741,-0.185209 0.0741,-0.465667 0,-0.280459 -0.0741,-0.465667 -0.0741,-0.185209 -0.21696,-0.275167 -0.13758,-0.09525 -0.33337,-0.09525 z m 1.96321,2.159001 v -2.645835 h 0.62971 l 0.0476,0.518584 q 0.10584,-0.275167 0.30692,-0.423334 0.20638,-0.148167 0.51329,-0.148167 0.09,0 0.16404,0.01587 0.0741,0.01587 0.12171,0.04233 l -0.0847,0.608542 q -0.0529,-0.02117 -0.1323,-0.03175 -0.0741,-0.01058 -0.19579,-0.01058 -0.15875,0 -0.30691,0.07937 -0.14817,0.07408 -0.24342,0.232833 -0.0952,0.153458 -0.0952,0.391584 v 1.370542 z m 3.40826,0.05292 q -0.41804,0 -0.73025,-0.164042 -0.30691,-0.164042 -0.47625,-0.470959 -0.16933,-0.306916 -0.16933,-0.740833 0,-0.433917 0.16933,-0.740834 0.16934,-0.306917 0.47096,-0.470959 0.30692,-0.164042 0.6985,-0.164042 0.40217,0 0.68263,0.164042 0.28046,0.15875 0.42862,0.439209 0.14817,0.275167 0.14817,0.629709 0,0.105833 -0.005,0.201083 -0.005,0.09525 -0.0159,0.169333 h -2.11137 v -0.502708 h 1.79387 l -0.34925,0.127 q 0,-0.333375 -0.15346,-0.513292 -0.14816,-0.179917 -0.42333,-0.179917 -0.20108,0 -0.34925,0.09525 -0.14288,0.09525 -0.21696,0.28575 -0.0741,0.185209 -0.0741,0.470959 0,0.280458 0.0794,0.465667 0.0847,0.179917 0.23284,0.269875 0.15345,0.08996 0.36512,0.08996 0.23284,0 0.37571,-0.08996 0.14288,-0.08996 0.22225,-0.248708 l 0.57679,0.22225 q -0.0847,0.206375 -0.25929,0.354542 -0.16933,0.148166 -0.40746,0.227541 -0.23283,0.07408 -0.50271,0.07408 z m 4.96359,0 q -0.48154,0 -0.84667,-0.211667 -0.35983,-0.211667 -0.56091,-0.613834 -0.20109,-0.402167 -0.20109,-0.968375 0,-0.560917 0.21167,-0.963084 0.21167,-0.407459 0.59796,-0.624417 0.39158,-0.216959 0.90488,-0.216959 0.5662,0 0.91545,0.211667 0.34925,0.206375 0.55563,0.645584
style="font-weight:500;font-size:4.23333px;font-family:'Work Sans';-inkscape-font-specification:'Work Sans Medium';stroke-linecap:round;stroke-linejoin:bevel"
d="m 102.20201,148.16407 q -0.0847,0.254 -0.254,0.4318 -0.16933,0.17357 -0.39793,0.26247 -0.2286,0.0889 -0.50377,0.0889 -0.40217,0 -0.6985,-0.17357 -0.29633,-0.17356 -0.457199,-0.4953 -0.160866,-0.32173 -0.160866,-0.77046 0,-0.44873 0.160866,-0.77047 0.160869,-0.32173 0.457199,-0.4953 0.29633,-0.17356 0.69427,-0.17356 0.27516,0 0.4953,0.0762 0.22436,0.0762 0.381,0.2286 0.15663,0.1524 0.2413,0.381 l -0.42757,0.1905 q -0.0847,-0.24977 -0.24553,-0.36407 -0.16087,-0.11853 -0.4191,-0.11853 -0.25824,0 -0.45297,0.12276 -0.19473,0.12277 -0.3048,0.3556 -0.10583,0.23284 -0.10583,0.56727 0,0.3302 0.1016,0.56726 0.1016,0.23284 0.2921,0.3556 0.1905,0.12277 0.4572,0.12277 0.25823,0 0.4445,-0.13123 0.1905,-0.13547 0.27093,-0.40217 z m 1.4478,0.78317 q -0.3175,0 -0.5588,-0.13123 -0.2413,-0.13124 -0.37677,-0.37677 -0.13123,-0.24977 -0.13123,-0.59267 0,-0.34289 0.13123,-0.58843 0.13547,-0.24976 0.37254,-0.381 0.23706,-0.13123 0.53763,-0.13123 0.30903,0 0.52493,0.127 0.2159,0.127 0.3302,0.34713 0.1143,0.22014 0.1143,0.49953 0,0.0762 -0.004,0.14394 -0.004,0.0677 -0.0127,0.11853 h -1.7018 v -0.34713 h 1.50283 l -0.22437,0.0677 q 0,-0.28786 -0.14393,-0.44026 -0.14393,-0.15664 -0.3937,-0.15664 -0.18203,0 -0.3175,0.0847 -0.13546,0.0847 -0.20743,0.254 -0.072,0.1651 -0.072,0.4064 0,0.23706 0.0762,0.40216 0.0762,0.1651 0.2159,0.24977 0.1397,0.0847 0.3302,0.0847 0.21167,0 0.3429,-0.0804 0.13123,-0.0804 0.20743,-0.22436 l 0.35984,0.16933 q -0.0762,0.1524 -0.20744,0.2667 -0.127,0.11007 -0.3048,0.16933 -0.1778,0.0593 -0.38946,0.0593 z m 1.51553,-0.0423 v -2.11667 h 0.38523 l 0.0423,0.381 q 0.0847,-0.20743 0.24977,-0.31326 0.16933,-0.11007 0.41487,-0.11007 0.0635,0 0.127,0.0127 0.0635,0.008 0.10583,0.0296 l -0.0635,0.39794 q -0.0466,-0.0169 -0.10583,-0.0254 -0.055,-0.0127 -0.1524,-0.0127 -0.13124,0 -0.25824,0.072 -0.127,0.0677 -0.21166,0.20744 -0.0804,0.1397 -0.0804,0.35559 v 1.12184 z m 2.26652,-2.73897 v 2.10397 q 0,0.15663 0.0804,0.2286 0.0847,0.072 0.22437,0.072 0.1143,0 0.19896,-0.0339 0.0847,-0.0381 0.15663,-0.1016 l 0.1016,0.3302 q -0.0974,0.0847 -0.2413,0.13546 -0.13969,0.0466 -0.31326,0.0466 -0.18203,0 -0.33443,-0.0593 -0.1524,-0.0593 -0.23707,-0.1905 -0.0847,-0.13546 -0.0889,-0.35136 v -2.05317 z m 0.72813,0.6223 v 0.3556 h -1.5875 v -0.3556 z m 1.25306,2.159 q -0.3175,0 -0.57996,-0.12277 -0.26247,-0.12276 -0.41487,-0.34713 l 0.31327,-0.27093 q 0.0931,0.17356 0.2667,0.2794 0.1778,0.1016 0.42333,0.1016 0.19473,0 0.30903,-0.0677 0.1143,-0.0677 0.1143,-0.1905 0,-0.0804 -0.055,-0.1397 -0.0508,-0.0635 -0.19897,-0.0974 l -0.4445,-0.0931 q -0.33866,-0.0677 -0.4826,-0.2159 -0.14393,-0.1524 -0.14393,-0.38523 0,-0.17356 0.1016,-0.32173 0.1016,-0.14817 0.29633,-0.23707 0.19897,-0.0931 0.47414,-0.0931 0.3175,0 0.54186,0.1143 0.22437,0.11007 0.3429,0.3175 l -0.31326,0.26247 q -0.0804,-0.16934 -0.23707,-0.24977 -0.15663,-0.0847 -0.32597,-0.0847 -0.13546,0 -0.23283,0.0339 -0.0974,0.0339 -0.14817,0.0931 -0.0508,0.0593 -0.0508,0.1397 0,0.0847 0.0635,0.14817 0.0635,0.0635 0.2286,0.0974 l 0.4826,0.1016 q 0.3048,0.0593 0.42757,0.2032 0.127,0.1397 0.127,0.3429 0,0.2032 -0.10583,0.35984 -0.10584,0.1524 -0.3048,0.23706 -0.19897,0.0847 -0.47414,0.0847 z"
id="text72"
aria-label="Certs" /></g></svg>
<figcaption>
A digram of what we're building.[^1]
</figcaption>
</figure>
<!-- more -->
I previously wrote about my Linked List project in [Building and Launching My
New Link Blog, linkedlist.org (Twice)](@/posts/2024/linked-list.md). While I
should have been focussing on writing content for the site, I instead continued
optimising what is currently a very low traffic website. Since the last post, I
added caching so that the application only renders a page once. After that, the
cached render result is reused for subsequent responses. These cached responses
are typically generated in about a third of a millisecond (~323µs on average),
which I was pretty happy with.
The problem was, for my convenience the server that hosts Linked List was
located in Australia, where I live. Unfortunately, most other people do not
live in Australia, and we're a long way from everywhere. This meant that
visitors would often encounter a lot of latency, just due to the
distances covered. Is this _really_ a problem for a lightweight website with
low traffic? Not really, but it bothered me, so I set about looking into
alt="Screenshot of the Gcore DNS configuration. There's three records. The first is assigned to North America, the second Europe, Africa, and South America, the last one is the default fallback record.",
caption="Gcore DNS configuration for linkedlist.org.") }}
* North America is served by the US server
* Europe, Africa, and South America are served by the French server
* Everything else is served by the Australian server
The default is the AU server because it's an existing server I already had that
has more RAM and CPU than the others. Some of these mappings were informed by
results from [PingBear]. I was also able to utilise the health checking in
Gcore to avoid resolving DNS requests to servers that are down for some reason.
### Taking It Live
With the DNS sorted, I finally switched the NS records for `linkedlist.org` over
to Gcore and started seeing each of the servers handle traffic 🎉.
One final detail: how is new content deployed? The content is independent of
the application, which monitors the content directory for changes, reloading as
necessary. Therefore deploying new content is done with a simple `rsync`. All
three servers are synced in parallel, with a bit of help from `xargs`:
alt="Screenshot of a Lighthouse report for linkedlist.org in Chromium. It shows 100 for performance, 82 for accessibility, 100 for best practices, adn 92 for SEO.",
caption="linkedlist.org Lighthouse report.") }}
While these results are good, I still only have a presence in three places
around the world. Notably absent are servers in Asia and Africa. Should I start
to see regular visitors from these or other countries the pyinfa config should
make it straightforward to add servers as needed.
For now though, I need to get back to writing on Linked List. If you haven't
checked it out already please do. It's also easy to [follow via RSS, Mastodon,
and Bluesky][follow].
### References
This series of three blog posts by Stefano Marinelli served as a good reference for
what I was trying to achieve. Stefano uses Varnish to add a layer of caching, which
I didn't do since the application manages caching itself.
* [Building a Self-Hosted CDN for BSD Cafe Media](https://it-notes.dragas.net/2024/08/26/building-a-self-hosted-cdn-for-bsd-cafe-media/)
* [Make Your Own CDN With OpenBSD Base and Just 2 Packages](https://it-notes.dragas.net/2024/08/29/make-your-own-cdn-openbsd/)
* [Make Your Own CDN With NetBSD](https://it-notes.dragas.net/2024/09/03/make-your-own-cdn-netbsd/)
[^1]: The icons in this diagram are from the [Haiku project][Haiku] used under
the terms of [their BSD license][haiku-licence]. Haiku is a really cool
operating system, you should check it out.
[^2]: This give plenty of headroom as each server is currently only using about 240MiB of memory.
[^3]: `/proc/cpuinfo` reports: Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz
[^4]: I covered `systemd-sysusers` in [a previous post](@/posts/2023/systemd-sysusers-and-chimera-linux.md)