The solar-powered home server worked for 15 months: uptime 95.26%


The first prototype solar server with a charge controller. Photo: solar.lowtechmagazine.com

In September 2018, an enthusiast from Low-tech Magazine launched a “low-tech” web server project . The goal was to reduce power consumption so that a single solar panel was enough for the home self-hosted server. This is not easy, because the site should work 24 hours a day. Let's see what happened in the end.

You can go to the server solar.lowtechmagazine.com, check current power consumption and battery level. The site is optimized for the minimum number of requests from the page and the minimum traffic, so it must withstand the jump in traffic from Habr. According to the developer’s calculations, the energy consumption per unique visitor is 0.021 Wh.

Shortly before dawn, on January 31, 2020, he had 42% of the battery remaining. Dawn in Barcelona at 8:04 local time, after which the current should go from the solar panel.



What for?


Ten years ago, experts predicted that the development of the Internet contributes to the “dematerialization” of society, universal digitalization - and, as a result, a decrease in overall energy consumption. They were mistaken. In fact, the Internet itself has demanded huge amounts of energy , and these volumes continue to grow.

IT companies have launched initiatives to switch to alternative power supplies, but this is now impossible. All data centers consume three times more energy than all the world's solar and wind installations. Even worse, the production and regular replacement of solar panels and windmills also requires energytherefore, abandoning the fossil toplif (oil, gas, uranium) today is simply impossible. But these reserves will not be enough for a long time, so we will inevitably have to think about how to live on renewable sources. Including the operation of computer infrastructure, including web servers.

Low-tech Magazine considers the problem of inflating web pages too fast. From 2010 to 2018, the average page size increased from 0.45 MB to 1.7 MB , and for mobile sites - from 0.15 MB to 1.6 MB, according to a conservative estimate.

Increased traffic ahead of progress in energy efficiency(the energy required to transfer 1 megabyte of information), which causes a constant increase in energy consumption of the Internet. Heavier and heavier sites not only increase the load on the network infrastructure, but also shorten the “life cycle” of computers and smartphones, which often have to be thrown away and made new, which is also a very energy-intensive process .

And of course, increasing the load is created by the lifestyle itself: people spend almost all the time on the Internet and rely heavily on various web services. It is already difficult to imagine a modern society without a cloud IT infrastructure (social networks, instant messengers, mail, etc.)

Server and website configuration


In this article described in detail the hardware configuration and software stack web server.

The Olimex Olinuxino A20 Lime 2 Single Board Computer is selected for its low power consumption and useful additional features such as the AXP209 power management chip . It allows you to request statistics on the current voltage and current strength from the board and from the battery. The chip automatically switches the power between the battery and the DC connector, where current flows from the solar panel. Thus, uninterrupted power supply to the server with battery support is possible.


Olimex Olinuxino A20 Lime 2

Initially, a lithium-polymer battery with a capacity of 6600 mAh (about 24 Wh) was chosen as the battery, then they put an acid-lead battery at 84.4 Wh.

The operating system boots from the SD card. Although the OS takes up no more than 1 GB and a static website is about 30 MB, there was no economic reason to buy a card smaller than Class 10 16 GB.

The server connects to the Network through a 100-megabyte home connection in Barcelona and a standard consumer router. A static IP address is reserved for it. Almost everyone can raise such a site in their apartment, you need to slightly change the firewall setting for port forwarding to local IP:

Port 80 to 80 for HTTP
Port 443 to 443 for HTTPS
Port 22 to 22 for SSH

Armbian Stretch operating system based on the Debian distribution and the SUNXI kernel , which is designed for single-board cards with AllWinner chips.


A 50-watt solar panel for a web server and a 10-watt panel for lighting a living room in the author’s apartment.

A static site is generated by the Pelican system (Python website generator). Static sites load faster and do not create a load on the CPU, so they are much more efficient than dynamically generated pages from the point of energy consumption. See the source code for the theme here .

A very important point is image compression, because without this optimization it is almost impossible to make web pages less than 1 megabyte. For optimization, it was decided to convert the photos to grayscale images. For example, here's a photo of a female telephone operator on a switch in the last century, 253 KB .



But the optimized grayscale image of 36.5 KB in size with three colors (black, white, gray). Due to the optical illusion, the viewer seems to have more than three colors.



Halftone photographs were chosen not only for size optimization (the solution is rather dubious), but also for aesthetic reasons. This old image processing technique has certain stylistic features, so the site has turned out in a way a unique design.

623 illustrations on the Low-tech Magazine website after optimization decreased in size from 194.2 MB to 21.3 MB, that is, 89%.

All old articles were converted to Markdown for ease of writing new articles, as well as for ease of backup through git . All scripts and trackers, as well as logos, were removed from the site. The default font is used in the client browser. As a “logo” - the name of the magazine in capital letters with a left arrow: LOW ← TECH MAGAZINE. Only 16 bytes instead of a picture.

In case of downtime, the possibility of “offline reading” is organized: texts and pictures are exported to the RSS feed. Caching of 100% content, including HTML, is included.

Another optimization is the inclusion of HTTP2 settings in nginx, which slightly reduces traffic and shortens page loading time, compared to HTTP / 1.1. The table compares the results for five different pages.

| | FP | WE | Hs | Fw | CW |
| ---------- | ------- | ------- | ------- | ------- | ------ - |
| HTTP / 1.1 | 1.46s | 1.87s | 1.54s | 1.86s | 1.89s |
| HTTP2 | 1.30s | 1.49s | 1.54s | 1.79s | 1.55s |
| Images | 9 | 21 | 11 | 19 | 23 |
| savings | 11% | 21% | 0% | 4% | 18% |


Full nginx configuration:

root@solarserver:/var/log/nginx# cat /etc/nginx/sites-enabled/solar.lowtechmagazine.com

# Expires map
map $sent_http_content_type $expires {
default off;
text/html 7d;
text/css max;
application/javascript max;
~image/ max;
}

server {
listen 80;
server_name solar.lowtechmagazine.com;

location / {
return 301 https://$server_name$request_uri;
}
}

server{
listen 443 ssl http2;
server_name solar.lowtechmagazine.com;

charset UTF-8; #improve page speed by sending the charset with the first response.

location / {
root /var/www/html/;
index index.html;
autoindex off;
}


#Caching (save html pages for 7 days, rest as long as possible, no caching on frontpage)
expires $expires;

location @index {
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-cache, no-store';
etag off;
expires off;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /var/www/;
#}

#Compression

gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;


#Caching (save html page for 7 days, rest as long as possible)
expires $expires;

# Logs
access_log /var/log/nginx/solar.lowtechmagazine.com_ssl.access.log;
error_log /var/log/nginx/solar.lowtechmagazine.com_ssl.error.log;

# SSL Settings:
ssl_certificate /etc/letsencrypt/live/solar.lowtechmagazine.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/solar.lowtechmagazine.com/privkey.pem;

# Improve HTTPS performance with session resumption
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;

# Enable server-side protection against BEAST attacks
ssl_prefer_server_ciphers on;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;

# Disable SSLv3
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

# Lower the buffer size to increase TTFB
ssl_buffer_size 4k;

# Diffie-Hellman parameter for DHE ciphersuites
# $ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 4096
ssl_dhparam /etc/ssl/certs/dhparam.pem;

# Enable HSTS (https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security)
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains";

# Enable OCSP stapling (http://blog.mozilla.org/security/2013/07/29/ocsp-stapling-in-firefox)
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/letsencrypt/live/solar.lowtechmagazine.com/fullchain.pem;
resolver 87.98.175.85 193.183.98.66 valid=300s;
resolver_timeout 5s;
}

Results of 15 months of work


For the period from December 12, 2018 to November 28, 2019, the server showed an uptime of 95.26% . This means that due to bad weather, the downtime for the year was 399 hours.

But if you do not take into account the last two months, the uptime is 98.2%, and the downtime is only 152 hours, the developers write. Uptime has fallen to 80% over the past two months, when power consumption increased due to software updates. Every night the site was down for several hours.

According to statistics, for the year (from December 3, 2018 to November 24, 2019), the server’s power consumption was 9.53 kWh. Significant losses were recorded in the photovoltaic system due to voltage conversion and battery discharge. The solar controller showed an annual consumption of 18.10 kWh, which means a system efficiency of about 50%.


Simplified scheme. It does not show a voltage converter from 12 to 5 volts and a battery ampere hour meter.

During the study period, 865,000 unique visitors visited the site. Including all energy losses in the solar installation, the energy consumption per unique visitor was 0.021 Wh. Thus, one kilowatt-hour of generated solar energy is enough to serve almost 50,000 unique visitors.

During the experiment, solar panels of different sizes were tested. The table shows the calculations for how long batteries of different capacities are charged when using solar panels of different sizes.



The average power consumption of the web server during the first year, including all energy losses, was 1.97 watts. The calculation shows that to maintain a website at night on the shortest night of the year (8 hours 50 minutes, June 21), you need 17.40 watts-hour of storage power, and on the longest night (14 hours 49 minutes, December 21) , 19 Wh



Since lead-acid batteries should not be discharged below half the capacity, the server needs a 60 Wh battery to survive the longest night under optimal daylight conditions (2 × 29.19 Wh). For most of the year, the system worked with a 86.4 Wh / h battery and a 50-watt solar panel, then the aforementioned uptime of 95-98% was achieved.

Uptime 100%


For uptime, 100% requires an increase in battery capacity. To compensate for one day of very bad weather (without significant power generation), you need 47.28 watts-hours (24 hours × 1.97 watts) of storage.

From December 1, 2019 to January 12, 2020, a 168-watt battery was installed in the system, which has a practical storage capacity of 84 watts-hours. This storage is enough to maintain the site for two nights and one day. The configuration was tested in the darkest period of the year, but the weather was relatively good - and during this period, the uptime was 100%.

But in order to guarantee an uptime of 100% for several years, it is necessary to foresee the worst case scenario, when bad weather persists for several days. The calculation shows: in order to maintain the site online for four days with low or zero energy generation, you will need a lead-acid battery with a capacity of 440 watts-hours, that is, the size of a car battery.

In practice, in good weather, a 48 Wh lead-acid battery will support the server during the night from March to September. A 24 Wh battery will keep the server for a maximum of 6 hours, that is, it will shut down every night, although at different times, depending on the month.

By and large, some sites do not have to work at night, when the number of visitors is minimal, according to the guys from Low-tech Magazine. For example, if it is a regional city publication, where visitors from other time zones do not go, but only local residents.

That is, for sites with different traffic and different uptime, batteries of different capacities and solar panels of different sizes are needed.





The author calculates how much energy is required to produce the solar panels themselves (realized energy) and how much is obtained if you divide this amount by the expected service life of 10 years.



Thus, it is possible to calculate an analogue of fossil fuels, which is spent on the production and operation of panels. At Low-tech Magazine it turned out that in the first year of operation, their system (50 W panel, 86.4 Wh battery) “generated” about 9 kg of emissions or the equivalent of burning 3 liters of gasoline: about the same as a passenger car for 50 km of progress.



If the server is powered not from solar panels, but from the general power grid, then the equivalent of emissions seems to be six times lower: 1.54 kg (the share of alternative energy and nuclear power plants is high in Spanish energy). But this is not a completely correct comparison, the author writes, because it takes into account the implemented energy of the solar infrastructure, but does not take this indicator into account for the total energy network, that is, the costs of its construction and support.

Further improvements


Over the past time, a number of optimizations have been carried out that have reduced server power consumption. For example, at some point, the developer noticed that 6.63 TB out of the total 11.15 TB traffic generated by one incorrect implementation of the RSS feed, which pulls content every few minutes. After fixing this bug, the server’s power consumption (excluding energy losses) decreased from 1.14 watts to about 0.95 watts. The gain may seem small, but the difference of 0.19 watts means 4.56 watts-hours per day, which corresponds to more than 2.5 hours of battery life.

In the first year, efficiency was only 50%. Losses were observed when charging and discharging the battery (22%), as well as when converting voltage from 12 V (solar photovoltaic system) to 5 V (USB), where losses are up to 28%. The developer admits that he does not have an optimal voltage converter (controller without built-in USB), so you can optimize this moment or switch to a 5V solar installation.

To increase the efficiency of energy storage, lead-acid batteries can be replaced with more expensive lithium-ion batteries, which have less charge / discharge loss (<10%). Now the designer is considering a compact system for storing electricity in the form of compressed air(CAES), which has a ten-year service life, which means less carbon footprint.


Compact energy accumulator in compressed air, source

We are considering installing an additional wind turbine (it can be made of wood ) and installing a solar tracker to turn the panels to the sun. The tracker allows you to increase electricity generation by 30%.



Another way to increase the efficiency of the system is to scale it. Raise more websites on the server and run more servers. Then the energy consumption per each site will decrease.


Solar hosting company. Illustration: Diego Marmolejo

If you cover the entire balcony of the apartment with solar panels and open a solar web hosting company, then the costs for each client will be significantly lower than for a single website: economies of scale.

In general, this experiment demonstrates that, under certain limitations, computer infrastructure may well work on renewable energy sources.

Theoretically, such a server can even do without a battery if you mirror it in other parts of the world. For example, put mirrors in New Zealand and Chile. There, solar panels will work when it is night in Barcelona.

Source: https://habr.com/ru/post/undefined/


All Articles