Skip to content

Commit 818046f

Browse files
kradalbynblock
andauthored
add faq section on scaling/performance (#2476)
* add faq section on scaling/performance Signed-off-by: Kristoffer Dalby <[email protected]> * Apply suggestions from code review Co-authored-by: nblock <[email protected]> --------- Signed-off-by: Kristoffer Dalby <[email protected]> Co-authored-by: nblock <[email protected]>
1 parent fe06a00 commit 818046f

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

docs/about/faq.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,58 @@ For convenience, we also [build container images with headscale](../setup/instal
4444
we don't officially support deploying headscale using Docker**. On our [Discord server](https://discord.gg/c84AZQhmpx)
4545
we have a "docker-issues" channel where you can ask for Docker-specific help to the community.
4646

47+
## Scaling / How many clients does Headscale support?
48+
49+
It depends. As often stated, Headscale is not enterprise software and our focus
50+
is homelabbers and self-hosters. Of course, we do not prevent people from using
51+
it in a commercial/professional setting and often get questions about scaling.
52+
53+
Please note that when Headscale is developed, performance is not part of the
54+
consideration as the main audience is considered to be users with a moddest
55+
amount of devices. We focus on correctness and feature parity with Tailscale
56+
SaaS over time.
57+
58+
To understand if you might be able to use Headscale for your usecase, I will
59+
describe two scenarios in an effort to explain what is the central bottleneck
60+
of Headscale:
61+
62+
1. An environment with 1000 servers
63+
64+
- they rarely "move" (change their endpoints)
65+
- new nodes are added rarely
66+
67+
2. An environment with 80 laptops/phones (end user devices)
68+
69+
- nodes move often, e.g. switching from home to office
70+
71+
Headscale calculates a map of all nodes that need to talk to each other,
72+
creating this "world map" requires a lot of CPU time. When an event that
73+
requires changes to this map happens, the whole "world" is recalculated, and a
74+
new "world map" is created for every node in the network.
75+
76+
This means that under certain conditions, Headscale can likely handle 100s
77+
of devices (maybe more), if there is _little to no change_ happening in the
78+
network. For example, in Scenario 1, the process of computing the world map is
79+
extremly demanding due to the size of the network, but when the map has been
80+
created and the nodes are not changing, the Headscale instance will likely
81+
return to a very low resource usage until the next time there is an event
82+
requiring the new map.
83+
84+
In the case of Scenario 2, the process of computing the world map is less
85+
demanding due to the smaller size of the network, however, the type of nodes
86+
will likely change frequently, which would lead to a constant resource usage.
87+
88+
Headscale will start to struggle when the two scenarios overlap, e.g. many nodes
89+
with frequent changes will cause the resource usage to remain constantly high.
90+
In the worst case scenario, the queue of nodes waiting for their map will grow
91+
to a point where Headscale never will be able to catch up, and nodes will never
92+
learn about the current state of the world.
93+
94+
We expect that the performance will improve over time as we improve the code
95+
base, but it is not a focus. In general, we will never make the tradeoff to make
96+
things faster on the cost of less maintainable or readable code. We are a small
97+
team and have to optimise for maintainabillity.
98+
4799
## Which database should I use?
48100

49101
We recommend the use of SQLite as database for headscale:
@@ -56,6 +108,9 @@ We recommend the use of SQLite as database for headscale:
56108
The headscale project itself does not provide a tool to migrate from PostgreSQL to SQLite. Please have a look at [the
57109
related tools documentation](../ref/integration/tools.md) for migration tooling provided by the community.
58110

111+
The choice of database has little to no impact on the performance of the server,
112+
see [Scaling / How many clients does Headscale support?](#scaling-how-many-clients-does-headscale-support) for understanding how Headscale spends its resources.
113+
59114
## Why is my reverse proxy not working with headscale?
60115

61116
We don't know. We don't use reverse proxies with headscale ourselves, so we don't have any experience with them. We have

0 commit comments

Comments
 (0)