Tips for choosing right server

How to choose right server for your app?

I need to start with the short statement - you probably don't need hosting or server. This article is dedicated mostly to tech people. If you are looking for tips how to pick a server for your website and you don't know what Shell, SSH or FTP is, please read only the chapter below:) If you want to jump to strictly tech stuff - click here.

You don't need hosting/server

If you are just starting a blog, small business website or e-commerce, don't bother looking for hosting and a developer who can create your website. These days we have great alternatives that will take care of your website from start to finish.

They will care about server infrastructure, security, backups, servers performance, updates to CMS, bug fixes and everything you need for having website up and running. You won't have to ask a developer to fix a bug or change a text on your website.

If you are just starting and you don't want to spend hundred of $$$ for a website you can try some services I will mention about. All you need is to have some time to configure everything. Most of them have free trial, so you can try it first for free. Some of them offers free features that are sufficient for lot of websites. Remember, you can always change it in the future to your self-hosted website.

If you plan to go with a blog and you want to focus on writing I suggest you get yourself familiar with https://wordpress.com and https://medium.com/

Medium is awesome alternative to popular WordPress. IMHO they have much nicer editor. If you care only about writing, try it first before going with WordPress:) You can always try both and decide which works better for you.

If you want to sell stuff online, go with https://www.shopify.com/  Super useful e-commerce with number of options. In general you need to buy a plan. Cheapest one is 29$ per month, but it's still cheaper and safer than running custom e-commerce like WooCommerce or Magento. They also have trial version:)

If you want to create a website for your business/company try WIX first - http://www.wix.com/ It's a website builder when you can create your own site with Drag&Drop. Lot of small businesses have websites build with WIX.

If you are fine with features that mentioned services are offering, you can stop reading here. Such services are great until you really need something custom. The feature that none of the services can offer. In such case you need to find someone who can build your website. You will need a hosting or server. If you need to look for server for your small website, make sure that you will choose right hosting plan.

If the website is small and it won't receive lot of traffic you should only pay attention to few details. I know that price will be important here, but remember. Sometimes the cheap comes out as expensive.

If you decide to go with shared hosting, your website will be slow or even unaccessible if lot of visitors will go to your website at the same time. You will need to change plan to something better or go with VPS/dedicated server. Make sure that you will choose such server with management (your server will have dedicated administrator). Trust me, if you don't know a thing about server administration and security, you don't want to choose unmanaged server:)

Make sure that they have backup plan, or do your own from time to time. Recently in Poland we have situation when one of the bigger hosting provider deleted all websites and thousands of people lost they websites permanently. They hosting plans were quite cheap so they got lot of clients. But after the incident all websites was down for 2 months. People who made backups on they own, rescued they websites quite fast, but rest lost their websites forever.

You can stop reading here. Rest of the things are for tech people! Unless you want to get some knowledge about servers:)

To cloud, or not to cloud?

Yes, you should go with cloud, but only if your website earns money. And I mean MONEY, not few dollars every month. Cloud is not cheap. It's expensive. And sometimes it can get really expensive. Like hundred of dollars every month. You pay the price, but you get a value.

We had a website that was mostly image based and got quite a lot of traffic. We were using Amazon AWS. Two EC2 instances (prod + stage), Elastic IP, S3. We paid around 500-600$ every month. Most of costs were traffic (around 2-3TB every month) and EC2. I felt like that's a lot of money for such website. Fortunately we didn't pay for it. Our client was big, was cloud oriented and money didn't matter, so we used AWS. But for my personal website and for lot of other websites 500$ every months is a killer.

So can you lower the costs somehow and still use cloud? Yes, you can. But first thing first.

Serverless maybe?

First you need to think about two important points.

  1. Do you have time to take care about server architecture, regular updates, configuration etc?
  2. Think about your application. Does it need specific server architecture, or you only care to have it up and running?

Most of people thinks - installing LAMP stack and setting some basic configuration is no brainer. Well, server management is unfortunately not that easy. Of course, your server will work for some time until you will get hacked or you will get some performance issues. And trust me, you will if you won't pay attention to your servers. We've been hacked twice, because we thought that server management doesn't require time and attention. Our servers has enormous load because of older version of few libraries. We were not even able to SSH to our servers;/

So if you only care about your app, try Heroku first. It's running in the cloud (on AWS actually), has support for tons of technologies and you don't need to care about server infrastructure at all. They will care everything for you. It feels that it might be expensive, but think if setting custom server + hiring server admin will not be more expensive?

Heroku is super convenient and powerful. You can setup and deploy your up within minutes. Their uptime is pretty good, scalability is nice and easy to configure. Give it a shot (they have free trial), maybe it will be much better than setting up a server 😀

Our solution

We go with old fashion way, with servers that we manage on our side. Downsides? We need to spend time to configure and maintain them. But from the other side we have full control of our server. And we don't pay $$$$$$$$$$$ for them:)

We adapt infrastructure to our projects. But in most cases it goes like that - VPS/Dedicated server/Cloud based server + Amazon S3 + CDN/Amazon CloudFlare.

Server features

When we are looking for server we are looking mostly at such features:

  1. SSH+Root
  2. OS and OS version
  3. CPU
  4. RAM
  5. SSD
  6. Transfer
  7. Additional IP address

SSH+Root - server must have SSH access. Era of FTP and manually uploaded files to server is fortunately behind us. So if server doesn't have SSH access it's not the right choice. Also, pay attention for full root access. We saw servers where you can login via SSH and do only basic stuff like GIT, creating files etc. But it was not possible to install anything. If it doesn't have root, you shouldn't use it.

OS - It's important to see what operating system they support. We are mostly looking for CentOS 7, as this is our OS of choice. If you want to go with Ubuntu, that's OK. We prefer CentOS. Version of the system is really important. Sometimes you can't install latest available version, like CentOS 7. If for instance latests supported version for server is CentOS6, we are looking for something different. Also make sure that it is x64 os. 32 has lot of limitations and you should avoid it.

CPU - we are mostly looking for processors with 2 or more cores. 1 core is enough if you want to run small app or only one website. But if you plan to go with something bigger, 2 or more cores will get you significant performance boost.

RAM - 1GB is minimum, but if it has much more RAM it's great. We avoid 512MB, it's way to small and you can get issues when you try to compile PHP from source for instance. Basically for optimisation, caching etc, it should have as much RAM as possible. We usually goes with 2GB and above. But 1GB is minimum you should aim for.

SSD - if it has SSD, that's great. We switched all our servers from HDD to SSD. Machines are much faster and more performant. Downside is that usually they are bit more expensive and have smaller disk sizes. If you need lot of disk space you should go with SSD + HDD.

Transfer - it is really important factor. If you will serve images from your server or you expect lot of traffic and you won't use CDN, you should go with 1-2TB per month. It really depends on the website and traffic, so it's hard to say how much transfer you will really need.

Additional IP addresses - if you plan to host multiple websites on single server make sure that it allows you to add additional IP address. If you want to go with SSL, and I'm sure you will want to do that, 1 IP address is not enough. You can't have two SSL websites on single IP address.

Your server does not have to be in Cloud, unless you want to get easier access to automatic scalability etc. We are using two providers mostly. For smaller apps/websites, we are using DigitalOcean. Simple pricing, nice servers, easy to use. Most of our servers are 10$ or 20$ per month. We don't go higher as it becomes more costly.

However if we need more horsepower, more RAM, CPU cores we are looking for something more performant. We are using dedicated servers for that. We tried multiple solutions but our favourite so far is Hetzner. They have really nice value for the money. For instance for around 50$ you can get 4 cores, 32GB rams and 30TB of traffic. Uptime is pretty high and their support is awesome. Highly recommended:)

How about pure cloud solutions?

You can of course go 100% with AWS, but as I mentioned above, it will cost you significant amount of money. It will have it's benefits, but I feel that AWS is dedicated to large companies and websites. I especially don't like their pricing as it's hard to predict how much you will pay for given configuration.

We however use AWS for two purposes.

Backup - it's important factor. Most of users that runs their own servers, usually forget about making backups. Guys, if you don't do backups, start today. Hard drives can break, you or someone else can delete something etc. Backup are super important thing! We are using S3/Glacier from AWS for this purpose. Once per day or every couple of hours we are making full backup of DBs/Images/Important data to AWS. It's really easy to setup and to use. After an hour or so, you should get your backups up and running. Glacier is relatively cheap and Amazon is taking care of persistence of our data.

CDN - If MaxCDN or CloudFront is not enough, we go with CloudFlare. IMHO they offer enormous number of features and configuration gives us much more power.

Should I use CDN?

Speaking about CDN. Should you use one? The answer is yes. It will give your website significant boost if your users are connecting from different countries. Hetzner has their servers in Germany, but some of our websites are worldwide oriented. CDN is a must here.

You can have CDN for free by using CloudFlare. They don't offer much options but it's for free:) If you have a blog with lot of images, it will also takes some of the transfer for you from the server. Images will be served from CDN instead of your server.

If free is not enough, you can use paid plan from CloudFlare or try MaxCDN.

If you need detailed control, we suggest to go with Amazon and their CloudFront:)

Summary

So it's all come down to how much time and money do you want to spend here. If you don't plan to run your own servers for your app, you should go with Heroku. If you want to play around with servers and want to have bigger control, go with DigitalOcean/Dedicated Server + S3/Backup server + CDN. It's the best value for money. If you have lot of money and you want best scalability and performance, go with AWS and all the features it offers;)

If you will go with DigitalOcean or custom server, you should learn about Ansible. It will save you lot of time when it comes to configuration of the server. Read the tutorial about Ansible.

If you want to learn how to configure your own server, you should read our series about setting up LAMP on steroids.