Blog post image

Raspberry Pi has been around for some years now and often there has been a debate about whether a Raspberry Pi would be a good web server or not. It cannot be denied that these little gadgets are handy, smart, and don't use much power, but can they potentially replace your web hosting company? In this article, we will talk about the pros and cons when you host your own website from a Raspberry Pi at home.

What is a Raspberry Pi?

For those of you that are not familiar with Raspberry Pi's, then it is a small single-board computer that you can buy with almost no money. They are very small and come with different specifications depending on what you need to use them for. 

When buying a Raspberry Pi you get the board/computer in a cardboard box and then you have to add the SD card, casing, and cooling yourself. The Raspberry Pi has to be set up with its own systems such as Raspbian or Ubuntu.

You can use a Raspberry Pi for many things, but some of the most used cases are listed here below:

  • Desktop computer
  • Media server
  • Webserver
  • Hacking device
  • Network security
  • Home server
  • NAS server
  • Backup server
  • TOR relay

As you can see, there are many things that a Raspberry Pi can be used for, and it is only your imagination that stops you. 

Pros and Cons when hosting a website from a Raspberry Pi.

With everything, you can find pros and cons, and that is also what we have done here. Below you will find a list of the pros and cons when hosting a website from your Raspberry Pi in your home.

Pros:

  • Low power consumption: The Raspberry Pi is using very little power, and by hosting from a Pi you will in many cases use less power than if you were hosting in a data center.
  • Full control: When hosting a website on a Raspberry Pi in your own home you are in full control of everything. Nothing is decided by anyone except you, so if you like to take control then full control is a plus.
  • Saving tons of money: Hosting your website on a Raspberry Pi that costs between 35-70USD is going to make you save tons of money. Some of the cheapest VPS hosting plans cost around 120USD per year, so already in one year, you would have saved money even though you spend on electricity.
  • Better for the environment: Many households today (At least in Europe) are running on 100% renewable energy and many data centers are not. Therefore by running your website on a Raspberry Pi at home, you have ensured that your website is running on renewable energy instead of coal or other polluting types. (Please check if you are using 100% renewable energy instead of only assuming).
  • Shorter travel distance: If your visitors or customers are located near your address, then the distance that your data will have to travel to get to your visitor's device will be smaller and also help lower the pollution caused by your website. The longer distance the data has to travel the more pollution it causes.

Cons:

  • Maintenance: Hosting a website on your own server at home requires lots of maintenance. You have to remember that you are in charge of everything and there are only you to do it.
  • Harder to scale: If your website is growing and you need to scale your system, then it will be trickier to do at home than in a hosting company since they handle it for you. At home, you need to figure out how to connect multiple Raspberry Pi's and load balance them.
  • Internet speed: Hosting a website requires a certain internet upload speed. Every time someone requests your website you will have to serve them within 2-3 seconds, and if your website is big or you have many visitors, then you are required to have a fast upload connection.
  • Dynamic IP: Many internet subscriptions today are using dynamic IP addresses that change from time to time. This makes it harder to host a website since it will break every time your IP changes. Luckily this can be fixed using a small software that will update your IP when necessary.
  • Port forwarding: When you host a website you have to open up certain ports on your router which potentially could make your home network unsafe. Before you do this you have to make sure you have secured your network properly. 

Hosting on a Raspberry Pi can be a better solution for the environment.

The first question you ask yourself when deciding whether to host your website on a Raspberry Pi or at a data center is probably not whether it is more environmentally friendly. But hosting your website on a Raspberry Pi at home can actually be more environmentally friendly than hosting it in a data center.

It all comes down to your project, your ambitions, and where your customers/visitors are located. If you for example are hosting a company website that is intended for people in your area and not someone on the other side of the earth, then you don't need to host your website in a data center that could be a thousand kilometers away, and you don't need a CDN to create cached copies of your website to make it load faster far far away. All of these things aren't needed and you would do both your visitors and the environment a favor by shortening the travel distance. Of cause, there are also other things playing a role such as whether your electricity is 100% renewable and if you already have an internet connection.

When you request data from your device it has to travel all the way from the server to your device. Sometimes that could be thousands of kilometers and others times hundreds. When the distance is shorter you will experience a faster loading speed and you will also in many cases cause less pollution. Along the way, there are receivers/senders that will help transport data from A to B, and each of these receivers/senders requires power which often is made by coal or other types of pollutions. So as you can imagine, the shorter distance your data has to travel, the less pollution it is causing.

Raspberry Pi 4 - Power consumption

Like every other electronic, a Raspberry Pi is using electricity, but because this is a single-board computer and very small, it only uses a little power. Laptop computers today use between 30 watts and 200 watts which will result in between 30 to 200 kWh pr 1000 hours. Therefore laptops are not ideal to run a single or two websites on unless they are very demanding.

The Raspberry Pi on the other hand uses very little power. We have pulled some stats from a Raspberry Pi 4B and below you can see the results:

  • Idle: 3.8 watts - 4 watts
  • 1 busy core: 4.5 watts
  • 2 busy cores: 5 watts
  • 3 busy cores: 5.5 watts
  • 4 busy cores: 6 watts

As you can see from the results, even a stressed Raspberry Pi won't use nearly as much electricity as a laptop computer and therefore it is better for running less demanding websites.

(Click to see the link we referenced the power consumption from)

The stats from above changes a bit depending on whether you run your Raspberry Pi headless, with a monitor, with a mouse, with a keyboard, with an external hard drive, or with an active fan for cooling. As a rule of thumb, they say that you should expect your Raspberry Pi to use approximately 40-60 kWh a year when running 24/7.

Raspberry Pi - HTTP requests per second.

A Raspberry Pi might seem like a harmless little machine that can't handle running a web server, but that is not at all true. In fact, if your internet connection is fast, your Pi is running SSD and you only serve a hello-world project page, then it can handle between 76.000 and 106.000 requests per second. The number of course drops when you start using images, videos, a database, etc, but this is just to show you that a Raspberry Pi can handle more than you might think.

(Stats has been referenced from here)

Conclusion

We have now looked at the pros and cons when it comes to hosting a website from a Raspberry Pi in your own home. As you can see there are ups and downs both when hosting at home and when hosting at a data center, but we hope that you have gotten the tools to analyze whether your project suits the nearest data center or a Raspberry Pi. 

There is no doubt that the internet is becoming a bigger polluter each day, and only by switching to sustainable web design, green web hosting whether it's at home or in a data center, and smart environmental thinking can we change the course.

Please feel free to share your thoughts below in our comment section. We would love to hear your opinion about hosting a website from a Raspberry Pi no matter if you have experience with it or not.