<\/span><\/h2>\r\n\r\n\r\n\r\nScaling out (horizontal scaling) is a much better option than scaling up (vertical scaling), as your business won\u2019t face any resource deficit.<\/p>\r\n\r\n\r\n\r\n
Simply adding more power to your server might create bottlenecks, especially when it is taken offline for upgrades. What will you do if there is a sudden traffic spike and you have to upgrade the server again? Hence with vertical scaling, you will be limited in terms of \u201cscaling up\u201d to solve such problems.<\/p>\r\n\r\n\r\n\r\n
Horizontal scaling, on the other hand, does not cause any resource deficit whatsoever. Businesses do not have to take their server offline while scaling out as this approach adds more resources to the existing ones. Horizontal scaling allows better elasticity than vertical scaling.<\/p>\r\n\r\n\r\n\r\n
A few benefits of horizontal scaling are as follows:<\/em><\/p>\r\n\r\n\r\n\r\n\r\nCosts as per the use<\/li>\r\n Inbuilt redundancy<\/li>\r\n High and continuous availability<\/li>\r\n No limits to hardware capacity<\/li>\r\n Allows easy sizing and resizing as per your requirements<\/li>\r\n No need to pay for peak demand <\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<\/span>Preferable Scaling Mode<\/span><\/h2>\r\n\r\n\r\n\r\nHorizontal scaling is a process of changing the number of nodes across a single layer. The preferable scaling mode for node groups can be selected when you create a new environment. Plus, you can use the topology wizard to adjust the scaling mode anytime for the existing one:<\/p>\r\n\r\n\r\n\r\n
\r\nStateless: <\/strong>it will create all new nodes simultaneously from the base image template <\/li>\r\nStateful: <\/strong>it will sequentially copy the file system of the master container into the newly created nodes<\/li>\r\n<\/ul>\r\n\r\n <\/p>\r\n\r\n
Stateless scaling mode is faster, while the stateful scaling mode automatically copies the custom configurations such as custom SSL or deployments.<\/p>\r\n\r\n\r\n\r\n
<\/span>Migration to stateless apps is in continuous YOY growth<\/span><\/h2>\r\n\r\n\r\n\r\nStateless infrastructure creates an ideal business model implementation as it focuses on the application rather than the infrastructure. Such an approach is growing quite popular due to its \u201ccool nature\u201d, as it has become an industry standard to actually solve problems.<\/p>\r\n\r\n\r\n\r\n
As per the Forrester reports, nearly 40% of enterprises across the world have already adopted a stateless approach, in some way or the other. The rest of them are still using stateful technologies along with the traditional deployment style, but are also planning to migrate to stateless technologies in the future.\u00a0<\/p>\r\n\r\n\r\n\r\n
<\/span>Stateless vs Stateful applications<\/span><\/h2>\r\n\r\n\r\n\r\nStateful and stateless are two scaling modes through which applications are designed to either store or not store the \u201cstate\u201d. This is later used for processing the requests.<\/p>\r\n\r\n\r\n\r\n
Applications that store data from one request to another, and then use it to run later are known as stateful. For example, a stateful application will save a client’s information locally or on a remote host and then use this data later when the client makes a request. When the client puts up a request, it will be set as a variable that changes the server\u2019s state. This change is stored in the memory, so if someone else tries to put up a request from another server with the same credentials, the connection fails as the second server does not have the right variable stored.<\/p>\r\n\r\n\r\n\r\n
Scaling horizontally in this circumstance is almost impossible. <\/p>\r\n\r\n\r\n\r\n
\r\nCharacteristics of stateless applications<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\nA stateless application is an app that does not continuously interact between requests. An entire session (a series of interactions taking place between two requests) is not stored in the memory of the application.<\/p>\r\n\r\n\r\n\r\n
A stateless application will not store data in a previous session to use it later in the upcoming session. Thus, each session acts as if it is running for the first time.<\/p>\r\n\r\n\r\n\r\n
Due to this approach, it doesn\u2019t matter which server client uses to make requests, as it does not store any state. After login, the server will send ID token containing session information, which the user can use to interact with the database.\u00a0<\/p>\r\n\r\n\r\n\r\n
Stateless applications scale horizontally very easily as compared to stateful applications due to the fact that infrastructure allows adding as many computing resources as needed.\u00a0<\/p>\r\n\r\n\r\n\r\n
<\/span>What makes your application stateless?<\/span><\/h2>\r\n\r\n\r\n\r\nStateless applications contain several microservices which can be easily scaled, and each one of them has a specific objective.\u00a0<\/p>\r\n\r\n\r\n\r\n
The best example of a stateless app is the authentication service. Its main goal is to authenticate credentials, verify them and send back an ID token used to accept requests.<\/p>\r\n\r\n\r\n\r\n
With stateless applications, you can focus on applications and not on infrastructure, as the server is managed by cloud vendors. Such apps save costs or at least keep them under control as you only have to pay for the resources you use. This is better than having machines ready to scale and pay for them at all times.<\/p>\r\n\r\n\r\n\r\n
Another benefit of stateless applications is that the infrastructure is portable and can also be decoupled. This simplifies the infrastructure, reduces cost and also boosts business productivity, operational efficiency and development velocity.<\/p>\r\n\r\n\r\n\r\n
Moreover, dynamic and horizontal scaling are inbuilt features in stateless apps to make sure the server doesn\u2019t crash no matter how high the traffic spike gets on the app.<\/p>\r\n\r\n\r\n\r\n
<\/span>How to achieve effective horizontal scaling?<\/span><\/h2>\r\n\r\n\r\n\r\nTo ensure your service is highly compatible with horizontal scaling, there are various crucial practices to keep in mind:<\/em><\/p>\r\n\r\n\r\n\r\nThe very first step is to make your application stateless as much as you can on the server side. Your application depends upon server-side tracking to check what it’s doing currently, and that user session is inevitably limited to that specific server. If you store all session-related specifics on browser-side, that session can seamlessly pass through multiple servers. Thus, the biggest advantage of horizontal scaling is its ability to handle a single session or hundreds\/thousands of single sessions across multiple servers interchangeably.<\/p>\r\n\r\n\r\n\r\n
The second step is to ensure your application development has a service-oriented architecture. If your app features self-contained and interactive logical blocks, you will be able to scale each one of them individually as per your workload needs. Developing your app with independent caching, application, web, and database tiers is always better. This will result in cost savings- as with this microservice architecture you don\u2019t have to scale up every component of your application.\u00a0<\/p>\r\n\r\n\r\n\r\n
You can follow the below steps to implement Horizontal Scaling Based On Triggers:<\/strong><\/p>\r\n\r\n\r\n\r\nStep 1 \u2013 Login to RoseHosting Cloud and create an environment for your application. You should see the following page:<\/p>\r\n\r\n\r\n\r\n <\/figure>\r\n\r\n\r\n\r\nClick on the Settings<\/strong> button of your environment. You should see the following page:<\/p>\r\n\r\n\r\n\r\n <\/figure>\r\n\r\n\r\n\r\nStep 2<\/strong> \u2013 Click on the Auto Horizontal Scaling button in left pane, you should see the triggers for your environment in the right-side<\/p>\r\n\r\n\r\n\r\nStep 3 <\/strong>\u2013 Click on the ADD button to add a new triggers. You should see the following page:<\/p>\r\n\r\n\r\n\r\n <\/figure>\r\n\r\n\r\n\r\nStep 4 \u2013<\/strong> Set an add node and remove the node condition based on the load and also choose the resource type that you want to monitor. Then, click on the Add<\/strong> button to apply the changes.<\/p>\r\n\r\n\r\n\r\nWhen your server load is more or less than the trigger value which you have defined. You will receive an email notification. You can enable or disable the email notification using the button as shown below:<\/p>\r\n\r\n\r\n\r\n