Now that you have your development environment set up and have your tools in your back pocket, it’s time to discuss what type of infrastructure you need for the production or public version of your web app. Depending on the activity and involvement of your web app, you need to pick the level of server performance that your application needs to run. In this section, I talk about the hosting, infrastructure, and bandwidth solutions you can use to make sure your web app can scale from one user to one million users.
There are few types of hosting for your web app. The following list compares the price, features, and scalability of some popular options.
Shared hosting: Vendors include GoDaddy, BlueHost, and Media Temple — and the price is low. A shared hosting solution means that you are sharing resources with other members on the same server. If another user on the server has a spike in traffic, your application suffers. This is a low-cost solution for users who have very low traffic or activity on their service.
This hosting is usually offered in service-managed plans, so the user doesn’t need to manage the server or make updates. An end user will see a Control Panel user interface and can make any changes without having to log into the server through SSH.
Virtual Private Server (VPS): Offered from Media Temple and Rackspace Medium, VPS solutions range from being medium to high in price depending on the size of the server you purchase. The difference between VPS and Shared is you are now guaranteed a minimum and maximum CPU, hard drive, and memory for your instance. It is still on a shared server, but only in its private instance.
In this hosting option, the server is self-managed and the user is usually responsible for installing and upgrading new versions and patches. Some companies offer service- managed plans; however, this is usually more expensive.
Cloud: Offered by companies such as Rackspace and Hosting, these hosting options can range in price from high to low because price is computed on usage instead of a flat rate. Cloud hosting has become a very popular choice for startups because the prices are variable depending on what you use. Unlike the other options, cloud hosting charges only when your servers are on and running. They also allow you to be flexible and scale your servers to new memory and hard drive space as you need it.
With cloud hosting, you manage everything with servers, from what OS to use to applica- tions to install. Unlike VPS, there is no pre-installed software. The end user must do it all.
Depending on your application’s need, you can select the solution that works for you. For high activity services that require users to make status like updates, a cloud solution would work well. It gives you the capability to scale up your resources depending on the activity level. In addition, if you don’t use all your resources, you pay only for what you use, which helps your bottom line.
The downside of going the cloud route is the level of skill required to set up the servers. As mentioned previously, most of the infrastructure is self-managed. Self-managed servers mean that you must install your web servers, database, and so on. Some companies offer a managed solution, but this option comes with a significantly higher price.
Table 3-2 lists the common infrastructure setups that you can choose, depending on your application:
Table 3-2 Types of Infrastructure Setup
For more basic web apps, a single-server solution provides a solid framework to start. As your app grows, you can always migrate to an n-tier system, depending on your needs. Although an n-tier system gives you flexibility over your environment, it is complex to maintain and manage within a small team. Without proper tools, you will find yourself searching for the problem longer than it takes to solve it.
Every web app has static files that need to be served every time the app is launched. When this occurs, your server processes these files and sends them to the client, which incurs bandwidth charges on most hosting providers. These bandwidth costs grow over time, depending on the usage. When serving static content, such as images and CSS files, it’s a good practice to allow services called Content Delivery Network (CDN) to deliver the content to lower your bandwidth and load times.
These CDNs cache the files on the web browser, which enables users to load the content faster. Amazon Simple Storage Service (S3) provides solutions for storing your images and CSS without affecting your hosting bandwidth or your hard-drive space. Big social network websites such as foursquare and Untappd use Amazon S3 to store the profile avatars, logos, CSS, and other images. The prices for storage and bandwidth are usually much lower for your hosting solution.