Horizontal Scaling

Unless you're in the technical field, there's a change you've never heard of the term "horizontal scaling", but it's a must have for any quality online operation. Simply put, it's a methodology that allows your online operation to easily scale to handle any volume very cost effectively, plus provides much greater reliability and redundancy ensuring your operation always remains online, both of which are crucial to operations such as a crypto-currency exchange.

The main advantages of ensuring your software fully supports horizontal scaling are:


How Does it Work?

Although not required, we highly recommend you host with DigitalOcean as not only do they offer excellent and cost effective hosting infrastructure that works beautifully for horizontal scalingg, but our back-end also fully integrates with their API. This allows us to monitor your server cluster and all droplets in real-time, and receive instant alerts via e-mail / SMS when a droplet goes offline, slows down, resource usage becomes heavy, or an attack is detected. Through our API integration, we can instantly perform various tasks such as deploy new droplets to handle increased volume, reboot / shutdown droplets, rebuild droplets, and much more. In a nutshell, you can concentrate on your business without ever having to worry about the technicalities.

What happens is you sign up for a free DigitalOcean account, add a credit card to your account, then generate a DigitalOcean API key and provide us with it. We add your API key into our back-end system, which then begins monitoring your cluster in real-time, and provides us the necessary access to fully take care of you. During both, initial setup and future maintenance, we can instantly create and deploy new droplets into your cluster as necessary, using the rules and limitations you set forth for us. If desired, you can take a hands off approach and allow us to handle the technical aspects while simply informing you via e-mail when droplets have been added, modified, etc. Or you can require us to authorize any action with you before continuing.

To begin, unless you are transferring an existing operation to use with a large volume, horizontal scaling propbably isn't necessary at first. Instead, you will be setup with one droplet to host the entire software at a cost of around $40/month. If desired, a second small droplet can be added, which will be properly secured behind a VPN and used to access the administration panel for greater security, as the public internet will not be able to connect to your admin panel. This keeps your initial hosting costs down, but if and when required, we can have horizontal scaling with a full cluster implemented within hours. Every client and operation is different, but to setup a basic cluster for horizontal scaling, you can expect the hosting fee to be around $250/month to start.

Technical Details

In case your interested, below shows a typical cluster configuration that we will utilize. Please note, I went blind about two years ago, so do not currently have a graphical representation, hence the textual one below will have to make do for now.


DB1-M | DB2-S | DB3-S | DB4-S APP1 | APP2 | APP3 | APP4 | EMAIL1 | EMAIL2 MSG REDIS1 | REDIS2 | REDIS3 | REDIS4 | REDIS5 | REDIS6 WEB1 | WEB2 | WEB3 | WEB4 | WEB5 | WEB6 | WEB7 | WEB8 LB1 | LB2

Where:

  • LB = Load balancers running haproxy with a floating IP. These take in all incoming HTTP requests, and evenly distribute them amongst the WEB servers. Only one load balancer is online at any given time, but if it becomes unresponsive for any reason, the floating IP assigned to it will immediately be reassigned to the second load balancer to reduce downtime as much as possible.

  • WEB = Front-end web servers running Nginx that handle all incoming HTTP requests. These are light-weight, read-only filesystems that output the resulting web page to the browser as quickly as possible, while leaving all heavy lifting of the software to the back-end application servers by relaying messages to / from the messaging server.

  • REDIS = redis is an in-memory storage engine, and offeres extremely quick access to limited data. The front-end web servers will communicate with redis for things such as authentication sessions, cached items, current exchange rates, and so on. Due to size limitations since it's an in-memory storage engine, only small amounts of recent and pertinent data is stored within redis.

  • MSGRabbitMQ package, which provides messaging service / queues between the front-end web servers and the back-end application servers. This accepts messages from all front-end web servers, and evenly distributes the load amongst the back-end application servers, so if / when volume increases, it's as simple as adding in additional back-end application servers to help handle that additional volume.

  • APP = The actual back-end application servers that handle all the heavy lifting of the software such as user registration, transaction and payment processing, initiating and fulfilling trades, submitting and managing support tickets, etc. Any process that may potentitally take more than ~0.1 seconds is automatically routed from the front-end servers via the messaging server, and handled by these back-end application servers.

  • EMAIL = SMTP servers running Postfix, and used to deliver all outgoing e-mail.

  • DB = The actual database servers, generally running mySQL although can be another engine, and store all data for the operation. Use database replication, so all writes hit the master database server, while all reads are evenly distributed amongst the slave servers.

There you have it, the basics of horizontal scaling, why it's crucial you ensure your software supports it, and a sample cluster configuration we use.

but our back-end also fully integrates with DigitalOcean's API. This allows us to monitor and maintain all droplets within your server cluster.

Technical Details