Application Scaling Adventures – Part 1

Source Code – https://github.com/ehelin/ApplicationScallingAdventures

I have always been fascinated with the question of how to scale software.  Historically, I thought scalability was performance.  So, after reading this cool article (see reference #2), I was inspired to explore this more in more detail.  While I am sure I have just scratched the surface, it seems like a good system should be able to grow up (i.e. Vertical Scaling) or out (i.e. Horizontal Scaling).   Wikipedia (see reference #1) defines Vertical Scaling as adding more resources to a single node and Horizontal Scaling as adding more nodes.

To put this into my software developer mind, I interpreted vertical scaling as more threads and horizontal scaling as more instances running the application running the treads.  The vertical piece seems pretty straight forward.  I think it is just multiple threads working on a broken up set of work.  To illustrate, I created a factory pattern based engine builder.  In the example, I simulate additional resources by calling the factory method one time for each resource added.  Please see ‘VerticalScaling.cs’ and the referenced classes for detail.

The horizontal was a little more challenging.  I am not sure I completely have this right yet, but I took the vertical scaling code and created instances of it.  To simulate separate instances running a copy of the application, I put each VerticalScaling.cs instance into a list and called them one after another without waiting.  Please see ‘HorizontalScaling.cs’ and the referenced classes for detail.

Both types have their uses.  However, vertical scaling definitively seems limited to how good of a machine the single node is working on.  Creating 10,000 threads on a one core box doesn’t do much good 😉  Horizontal scaling seems more appropriate as you can add an almost endless list of nodes.  The real challenge is to accurately break up your work…perhaps using a Map Reduce algorithm like Hadoop and other distributed systems do.

This seems to work as I expected.  Let me know if you disagree or have a better way to show this.

Stay tuned!

References
1) https://en.wikipedia.org/wiki/Scalability
2) http://highscalability.com/blog/2014/3/17/intuitively-showing-how-to-scale-a-web-application-using-a-c.html
3) https://www.quora.com/Whats-the-best-way-to-learn-how-to-scale-web-applications

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s