As we want to offer a system where people can create their own website, we also need to offer them a very easy way to setup their own domain name for their website.
This requires a dynamic name server such as bind9 with the nsupdate tool.
Note that first, we can create a new website using a sub-domain name from a main domain used to run the system as a whole (as you see in many blog services). However, even that requires a dynamic DNS.
nsupdate can be used by one of our backend to do that part of the setup. We certainly want to make use of a specific plugin to do the work, hence this entry.
The plugin will handle the end user setup of the domain name (i.e. whether to use "www" or not and whether to understand the "w", "ww", and "wwww".) It can also allow for other sub-domains to be used to send users to specific places on their website.
In order to support more incoming requests, we want to use multiple front end computers. Each one of these can be pretty small (i.e. pretty cheap) and the DNS can offer a simple cyclic IP address feature as offered by bind. In order to get that to work, we just need to give each name once per front end IP address. For example, say we use computers 192.168.0.1 to 192.168.0.3, we would have the following records:
www 1 IN A 192.168.0.1 www 1 IN A 192.168.0.2 www 1 IN A 192.168.0.3
Note: the 1 represents the time to live of that name. We suggest a rather small number, but we have not tested that feature thoroughly yet. A "much" larger amount such as 300 may be wiser since a DNS access can also be slow and have so many all the time may be much worse than having many hits from one client on the same computer.
The DNS will then cycle through those 3 IP addresses so each client request can be given a different IP address and hopefully distribute the load among all your computers.
This is certainly the easiest way to handle load. The other method is to use a load balancer. However, on a cloud system where local connections have to be encrypted using a VPN, a load balancer may actually itself kill your performance (without the VPN, you'd definitively be fine!)
Under Linux, you can use HAProxy. It is used by many large websites in the world and is quite robust. It is also going to take you a little bit of time to set it up compared to load distribution.
It is important to note that this causes problems. Domain names are used to find the data in the Cassandra database. So changing the name changes all the keys of an existing website. However, we can setup a website with an internal redirect to palliate to the immediate problem.
For example, one could give a name to their website such as "my-website". This would become a domain name such as "my-website.snap.website". That means all the pages will be found with that fully qualified domain name. Now the user purchases his own domain name such as "best.club" and wants to now change his website domain to use "best.club". With the internal redirect feature, the domain "best.club" is first changed to "my-website.snap.website" then the process starts with that "old" sub-domain. One problem with that, though, if some plugins generate fully qualified URLs, it will certainly include the domain name and thus users will be redirected to "my-website.snap.website". This is a problem in the long term.
A possible solution is to offer the owner to make the existing website (my-website.snap.website) read-only while copying the site to the new domain (best.club). Once converted, we change the access URL to the new domain and add a full redirect from the old domain to the new one. So if someone goes to my-website.snap.website, we automatically redirect them to best.club.