# Geminispace speed

I really have some curse with connection issues last time.

Before, it was just broken ethernet socket, where the reason described in

=> tricky-ethernet.gmi Tricky Ethernet

By replacing the wires, found also that gemini pages loading much slower, comparing to huge HTML in Firefox.

I have nice optical provider, so the issue 99% is local. Much local.

Even asked on Station where found nobody have same problem:

=> gemini://station.martinrue.com/ps/fbfeda03ab214257bab096e5a0df5d41

After some time of thinking, found that I've configured custom Alfis DNS resolver:

=> https://github.com/Revertron/Alfis

This resolver running on the remote machine and connection there established with encrypted Yggdrasil tunnel:

=> https://github.com/yggdrasil-network/yggdrasil-go

So well, let's ping current DNS instance first:

``` Alfis server over Yggdrasil
PING 301:5eb5:f061:678e::53(301:5eb5:f061:678e::53) 56 data bytes
64 bytes from 301:5eb5:f061:678e::53: icmp_seq=1 ttl=64 time=212 ms
64 bytes from 301:5eb5:f061:678e::53: icmp_seq=2 ttl=64 time=58.6 ms
64 bytes from 301:5eb5:f061:678e::53: icmp_seq=3 ttl=64 time=55.0 ms
```

An attempt to resolve latency for initial Yggdrasil connection:

Q me
> Is any way to change handshake lifetime if I own both nodes connected?

A @neilalexander
> Not at the moment, no, the session timeout is ~1 minute IIRC

Well, let's check DNS points now:

``` Google
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=116 time=27.9 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=116 time=27.8 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=116 time=27.8 ms
```

``` CloudFlare
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=60 time=1.13 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=60 time=1.29 ms
64 bytes from 1.1.1.1: icmp_seq=3 ttl=60 time=1.72 ms
```

``` AdGuard
PING 94.140.14.14 (94.140.14.14) 56(84) bytes of data.
64 bytes from 94.140.14.14: icmp_seq=1 ttl=55 time=177 ms
64 bytes from 94.140.14.14: icmp_seq=2 ttl=55 time=177 ms
64 bytes from 94.140.14.14: icmp_seq=3 ttl=55 time=177 ms
```

By irony, Alfis resolver has default forward option:

=> https://dns.adguard.com/dns-query

Including remote connection over Yggdrasil (plus initial routing time),
I have about 500ms delay in total, just for IP resolve before page starting to load.

## Solution

* It's better to run Alfis on localhost as canonical
* Switch to CloudFlare 1.1.1.1:53 on remote /etc/alfis.conf
* Use Gemini client, that supports DNS cache (e.g. network.dnsCacheExpiration option in about:config) or just delegate this feature to the system-wide environment

## Conclusion

* Secure connection has it cost
* Geminispace is good place to find new issues about routing config