1

I am currently developing a web application and am trying to figure out the best way to host it. I've looked around, used dozens of different phrasings, read hundreds of posts and comments. but none of them seem to answer this particular aspect of the question. they explain how to calculate the number of current users a particular instance of a app can handle. but not how determine where to go form there to reach your goal. I've looked at cloud, I've looked at VPS and I have of course considered dedicated all have different prices but in the end I realized it all comes down to which direction you need to scale (Vertically, Add more power to any one instance of the app via more CPU power and more ram; or horizontally, Add new instance of the app and load scale them)

Part 1

Lets go with a small scenario for now Lets say you have an API application. it takes HTTP requests and responds with JSON, weather it is built in Node, Rails, PHP or anything else is irreverent. Assuming you can estimate all these factors at peek hours: Concurrent Users: 100 -> 1000 -> N Requests per minute per user: 1? 10? 50? size of data transferred on average per request: 1Kb? 2KB? 5KB? 10?

How do you determine which direction is best to scale? is it the ratio of these factors? is there some point that one of these factors can reach where you will have to scale in the other direction to handle it?

Part 2

This time lets assume a different type of application. This time it's a web-socket app that handles real-time data exchange, like chat, or event notification (events pushed from a message Q like Redis or RabbitMQ) This app (form what I gather) will scale completely differently from the same factors as Part 1 how do you determine which direction to go?

Overall

I'm asking these question to figure out which type of hosting would be best for which app. which will give me more stability? which will let me keep more money in my pocket for the same number of users?

Ryex
  • 11
  • 2
  • 1
    You compare the options and select the best one for your specific use case. There's no magic, or one-size-fits-all formula. – HopelessN00b Mar 26 '13 at 11:56

1 Answers1

1

This question would be nearly impossible to answer in it's current form because it's too broad of a subject. The things required to answer this involves a whole field of engineering where people make a living doing full time (including myself). IMHO, it's part science and part art, and you'll find multiple books (per my colleague) out there that talks about this subject.

Therefore, I can only provide a few brief, broad pointers.

  • There is no single formula to determine the best direction to scale. Given multiple applications with the same metrics captured and forecasted, the way to scale them may be entirely different. It really all depends on where the bottlenecks are based on application (mis)behavior.
  • The best way is really test and measure. Make sure your application is instrumented so that you can test the application with varying loads and observe/measure the effects on ALL its resources (server, network, etc.). You'll also need to test as you scale in varying directions.
  • From experience, most web app scaling issues aren't even (or shouldn't be) solved by throwing more hardware/resources at it. More often than not, it's the code and its inefficiencies (which I classify as a defect)

With that said, if I were to do all that and need to pick one hosting solution, the one with the most flexibility and capability, both in terms of product offering and ability to control costs, is Amazon Web Services (AWS). It's the only hosting provider I've used that comes close to big corporate datacenters and provides most of the features I was looking for. Key features are:

  • You can actually host your application there to start with at no (or nearly no) cost using their free tier
  • You can scale vertically (increase CPU and memory on a single host) with a few clicks and a reboot
  • You can scale horizontally (of course) with more servers and other dependent services (such as load balancers)
  • They have many other services beyond VM hosting (EC2 service is just one of their services)

I have no experience with other IaaS providers (Rackspace, Microsoft Azure, etc.), so I can't compare nor contrast them. Perhaps this will help get you down some road to start your research.

Disclosure: At the time of writing this answer, I do no own any shares of Amazon stock or work for them =)

martian111
  • 381
  • 1
  • 6
  • So it basically some down extensive testing? in that case what is a good place to start that testing? I'm going to be hosting 2 interconnected apps, an API and a websocket. would you suggest first going with a small VPS/Dedicated server putting both apps and the database on it? or 2 EC2 instances with a RDS? – Ryex Mar 26 '13 at 22:22
  • If you have API's, then I would expect you'll be able to easily test it with scripts that calls the API (e.g., using curl in a loop at various intervals). My QA engineering friends speaks highly of Selenium, and so does this [answer](http://stackoverflow.com/questions/340564/best-way-to-stress-test-a-website). In terms of servers, you can start with 1 EC2 micro or small instance instead of a small VPS (EC2 == VPS). It's just easier to increase the size of the node/number of nodes without needing to reconfigure servers from scratch. How much Amazon (RDS or not) to use depends on your budget. – martian111 Mar 27 '13 at 09:02