Add hosting guidelines

This commit is contained in:
2020-08-27 14:41:26 +02:00
parent e66a52e648
commit 7c0dcfb08f
6 changed files with 158 additions and 7 deletions

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -38,6 +38,33 @@ spare some coins. Possible methods for donating are:
href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WU49A5NHPAZ9G&source=url">
Donate with PayPal</a>
## How does pixeldrain store files?
Pixeldrain uses a few different techniques to store files cheaply, efficiently
and performantly. The servers which accept files from users have a hard disk
drive cache of typically a few terabytes (4 to 16). This is where most of the
files are kept. When a file is requested from another server it will look up
where the file is stored using a lookup table in the shared database. It will
then try to contact that server to request the file and proxy the data directly
to the requesting user.
Each server keeps track of which files are popular with its own userbase. This
includes files which it is not storing locally. It does this using a popularity
score. Every time a request to read a file comes in it will add 1 to the score
of that file. This score will slowly degrade over time. Periodically the server
will request all files with a high popularity score so it can store them locally
to save bandwidth. If there is not enough space available to store these popular
files it will move some less popular files to the next storage medium to make
space available for the more popular files.
The next storage medium is Sia. This is where all the files live which are not
requested frequently, but are still occasionally needed. Sia is a storage
marketplace where anyone can sell their storage space for financial compensation
in Siacoins. If you have storage space available and would like to provide it to
pixeldrain and other services you should read our [Sia hosting
guidelines](/hosting). There we explain which requirements we are setting for
hosts and some handy tips for getting started with hosting.
## Do I need to register an account?
Not if you don't want to. You're free to use pixeldrain completely anonymously.

119
res/include/md/hosting.md Normal file
View File

@@ -0,0 +1,119 @@
# Sia hosting guidelines
Pixeldrain uses [Sia](https://sia.tech) to offload files which are not requested
often, but still need to be kept. Sia is a free storage market where any host
can choose their own pricing. Because of this the users of the network need to
be careful when choosing the hosts to make contracts with.
Because pixeldrain is fairly cost-constrained we are forced to set some hard
requirements on storage and bandwidth pricing for Sia hosts.
## Rates
We will only make contracts with hosts that fullfill all these requirements.
Keep in mind that these are maximums, you are allowed to go lower.
| Requirement | Max rate |
|--------------------------|----------------|
| Contract formation price | €0.001 |
| Storage price per month | €2.00 / TB |
| Download price | €1.00 / TB |
| Upload price | €0.50 / TB |
| RPC price | €0.0001 |
| Sector access price | €0.0001 |
| Collateral per month | €6.00 / TB |
This may seem low, but keep in mind that these prices are before redundancy. We
have to upload all our data three times to the Sia network in order to reach
high availability. If you multiply everything by three it becomes much more
reasonable.
Other settings we pay attention to:
| Setting | Recommended value |
|-----------------------|-------------------|
| Max contract duration | At least 3 months |
| Proof window duration | 1 day |
| Download batch size | At least 16 MiB |
| Revision batch size | At least 16 MiB |
## Tips and tricks for becoming a better host
### Use a stable Linux or BSD-based operating system
Sia is known to run better on Linux or BSD based operating systems. Windows is
discouraged due to I/O reliability issues. Windows often sacrifices reliability
for better performance, because of this crashes are more common on Windows and
also have a greater chance of resulting is data loss. Forced updates and other
interruping system processes are also likely to harm hosting uptime and
performance.
We can recommend Debian, CentOS or Ubuntu LTS for hosting. These are systems
which are known to be able to run uninterruped for decades at a time. They are
also regularly patched with security updates which don't even require restarting
most of the time. This makes these systems perfect for the role of hosting on
Sia.
### Enable TCP BBR and other network stack optimizations
BBR is a new congestion control agorithm which dramatically decreases the time
needed for a TCP connection to ramp up to maximum speed. It also contains
improvements to counter other problems like router buffer bloat which causes
network latency spikes. Here's an [in-depth analysis of the benefits of enabling
BBR](https://blog.apnic.net/2017/05/09/bbr-new-kid-tcp-block/).
To enable BBR you need yo have kernel version 4.9 or higher. See your kernel
version with `uname -a`. On Ubuntu you can upgrade to a newer kernel by
[enabling HWE](https://wiki.ubuntu.com/Kernel/LTSEnablementStack).
Create a file called `/etc/sysctl.d/60-bbr.conf` with the following contents:
```
net.core.default_qdisc = fq_codel
net.ipv4.tcp_congestion_control = bbr
net.ipv4.tcp_notsent_lowat = 16384
net.ipv4.tcp_slow_start_after_idle = 0
```
After doing that you can run `sysctl -p` or reboot to apply the changes. Verify
that it's working with this command: `sysctl net.ipv4.tcp_congestion_control`.
It should return `bbr`.
Here's a more in-depth [guide to the configuration of the linux network
stack](https://www.cyberciti.biz/cloud-computing/increase-your-linux-server-internet-speed-with-tcp-bbr-congestion-control/).
### Use Sia Host Manager to configure your host
SiaCentral's [Host Manager](https://siacentral.com/host-manager) is a great tool
for monitoring and configuring your host. It explains all the settings in
detail, gives an option to set prices in any currency you like and gives
detailed insights into your contracts and revenue stream.
### Sign up for SiaStats host alerts
When your host is configured properly SiaStats will monitor its uptime and
performance. These stats are important for renters to discover good hosts and to
get an overview into the state of the hosting network.
If your host has been online for a while it will show up on SiaStats' [hosting
page](https://siastats.info/hosts). If you search for your host there will be an
option to sign up for hosting alerts.
### IPv6 capability is encouraged
Pixeldrain makes heavy use of IPv6 across its systems. We do this because we
believe that IPv6 is a critical component for the free internet. The old IPv4
requires terrible hacks like NAT to work at a large scale. IPv4 addresses are
also scarce and expensive to rent. All this money is thrown away on a legacy
system for which a replacement has already existed for over a decade. NAT limits
the growth of peer-to-peer software by making it impossible for applications to
communicate freely over the internet. Instead we need to add more hacks on top
like port forwarding to make it work. This has harmed the growth of the open
internet a lot over the decades and will harm it more if we keep going like
this.
So enable IPv6. If you don't have IPv6, call your ISP and ask them why not.
<div style="margin-top: 100px; height: 128px; text-align: center;">
<a href="https://sia.tech/">{{ template "built-with-Sia-mono.svg" . }}</a>
</div>

View File

@@ -298,7 +298,11 @@ a:hover {
text-align: left;
max-width: 40em;
}
table:not(.form) {border-collapse: collapse; width: 100%;}
table:not(.form) {
border-collapse: collapse;
width: 100%;
margin: 14px;
}
tr:not(.form) {border-bottom: 1px var(--layer_2_color_border) solid;}
tr > td, tr > th {padding: 0.3em;}
@media(max-width: 30em) {
@@ -311,8 +315,8 @@ tr > td, tr > th {padding: 0.3em;}
}
}
pre{
padding: 2px;
pre {
margin: 16px;
border-bottom: 1px var(--layer_2_color_border) solid;
overflow-x: auto;
}

View File

@@ -43,10 +43,8 @@ func adType() (i int) {
switch i {
case 0, 1, 2, 3: // 50% of the traffic
return 1
case 4:
return 2 // 12.5%
case 5, 6, 7:
return 0 // 37.5%
case 4, 5, 6, 7: // 50%
return 2
default:
panic(fmt.Errorf(
"random number generator returned unrecognised number: %d", i),
@@ -160,6 +158,7 @@ func (wc *WebController) serveFileViewerDemo(w http.ResponseWriter, r *http.Requ
"description": "A file to demonstrate the viewer page",
"mime_image": "/res/img/mime/text.png",
"thumbnail": "/res/img/mime/text.png",
"abuse_type": "",
},
}
err := wc.templates.Get().ExecuteTemplate(w, "file_viewer", templateData)

View File

@@ -115,6 +115,7 @@ func New(
{GET, "widgets" /* */, wc.serveTemplate("widgets", false)},
{GET, "about" /* */, wc.serveMarkdown("about.md", false)},
{GET, "appearance" /* */, wc.serveTemplate("appearance", false)},
{GET, "hosting" /* */, wc.serveMarkdown("hosting.md", false)},
// User account pages
{GET, "register" /* */, wc.serveForm(wc.registerForm, false)},