hosting-web

Choosing Your Web Application Hosting Platform

So you want to put your application up on the internets.  Great! So where should you start? There are a lot of hosting companies out there and the terms and offerings are overwhelming.  How much RAM do you need?  How many CPUs? How much disk space is enough?  Should everything be on one server or should each component live on a different server?  How reliable are they?  Will they still be here in a year? We have experimented with a lot of hosting companies and have settled on two hosting platforms, Digital Ocean and AWS Elastic Beanstalk.

Digital Ocean

Specs:
  • 2Gb Digital Ocean server with Homestead – $20 / month
    • Nginx
    • Mysql
    • Periodic image backups
Most applications are happy with the Basic setup.  We like Digital Ocean because of the simple control panel user interface, the low monthly price, and because all of their servers use solid state drives that are wicked fast. Also, they are witty.

Easy to Maintain and Cost Effective

In the basic platform, all supporting components are hosted on one server, i.e. the web server, database server, and file server all live in the same box.  This makes configuration and system maintenance pretty straightforward and for most applications.

Performance Limits

The basic platform will be pretty fast for a reasonable number of users, but some applications start to see performance issues as their user base grows.  One of 3 things will happen:

The server runs out of disk-space

For applications that are heavy in digital content, like images, videos, PDFs or zip-files, disk space can become a limiting factor.  Running out of disk-space on a server can be a very bad thing as it can cause BAD THINGS like corrupt database files.  The Basic setup offers about 40GB of disk space which is plenty of space for most applications.

The CPU becomes a bottleneck

The CPU is the part of the server that does all the work.  When lots of requests come into the server (i.e. your application is a hit!) the CPU spends a lot of time interpreting incoming requests and then doing the work.  If the application is complicated and does a lot of data processing, even a few requests can max the CPU out.  There’s a lot we can do in how we build applications and offload “thinking” to the database to make maximum use of the CPU, but eventually, with enough demand, we run into the static limits of the server.

Memory swaps to disk

Both the web server and the database server need space in memory to process information.  The 2GB offered by the basic setup provides enough space to handle a reasonable amount of in-memory processing. The system will always try to load data into RAM first, but once all the RAM is occupied, it uses what is called swap space on the hard drive.  Even though this setup uses solid state drives, it’s still about 10x slower to pull data from the hard drive than RAM.  Typically, once the database grows past 500MB of data, we start seeing performance issues arising from insufficient RAM. For these situations, the easy solution is to kick the Digital Ocean server up a notch, and in some cases this is the right decision.  It’s quick to do, and may resolve the performance issues without much effort.  In other cases, when we think the system limits may still be an issue, we migrate the applications to AWS Elastic Beanstalk.

AWS Elastic Beanstalk

Specs:
  • AWS – min $80 / month, it depends
    • EC2 – M3 instances with Homestead
    • Elastic Beanstalk – Autoscaling EC2 instances
    • RDS – MySQL DB Server
    • S3 – File Server
    • CloudWatch – Log / Metric Monitor
This setup uses all the same components (web server, database server, file server) as the Basic setup but with a much more sophisticated architecture.  The goal of this architecture is to remove all possible scaling limits from the application’s performance.

Unlimited Web Server CPU and Memory

This setup relies on an Amazon tool called Elastic Beanstalk.  It’s a funny name for an amazing tool.  Elastic Beanstalk watches the average CPU load of your web server, and if it grows past a limit, it spins up a new server, installs all the necessary software and code, and then shares the traffic across both servers.  Still more traffic?  Spin up a third, fourth and so on.  Once the traffic dies down, Elastic Beanstalk starts trimming down the servers as long as the CPU load stays below a threshold. So your web server can handle pretty much unlimited traffic and you only pay for what you use.

Easily Scalable Database

By separating the database server from the web server, we can adjust the resources of each independently.  Typically a database server can server multiple web servers without any performance impact.  If the database does become the bottleneck over time, or requires more disk space, it only takes a couple of clicks through the AWS dashboard to increase the Memory, CPU, and disk space for the database server.  Also, as part of their RDS offering, Amazon keeps the database server up to date with all the latest security patches and minor releases, making this a very low maintenance component.

Unlimited Storage

Instead of the traditional approach of using the disk space on the web server to store files, this setup uses the AWS S3 distributed file store. S3 is a ‘hard drive in the sky’ with essentially limitless capacity. S3 does a great job of holding the assets (images, videos, …), and serving them up very quickly.  Also, because these files are not hosted on the web server, it doesn’t waste any processing power or bandwidth delivering the files.

So What?

You have options, but it doesn’t have to be as complicated as it seems. Most of our customers use the Single Server hosting platform because it lets us build and deploy their application quickly and cost effectively. For some, once they get enough traction where the performance limits show, we help them migrate to AWS Elastic Beanstalk, where they should be well served for years to come. We’re here to answer your questions!  Give us a call (877) 669-8989 or email us at hello@purposebuiltsoftware.com to chat!