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.
- 2Gb Digital Ocean server with Homestead – $20 / month
- Periodic image backups
Easy to Maintain and Cost EffectiveIn 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 LimitsThe 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-spaceFor 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 bottleneckThe 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 diskBoth 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 BeanstalkSpecs:
- 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