If you’re like many of our clients, you’re facing the big challenge of scaling up to keep pace with growing demands—without dropping the ball on performance or user experience. That’s no small task, right? Here at Adaptiv, we get it. Scalability isn’t just about growing bigger; it’s about becoming more capable and efficient under pressure. Stick with us as we dive into how MuleSoft CloudHub can help you scale smoothly and smartly, ensuring your applications are ready to easily handle whatever comes next. In this blog, we will look at the common types of scaling and how these can be easily achieved on the Mulesoft platform.
What is Scaling?
When we talk about scaling APIs we are usually referring to Vertical and Horizontal scaling. But what does this actually mean?
Let’s imagine we’re tasked with transporting boxes from one warehouse to another.
Horizontal scaling is akin to distributing the boxes across multiple trucks, each carrying a portion of the load.
Vertical scaling, on the other hand, is comparable to increasing the size of a single truck to accommodate transporting more at once.
So which approach is right? In the words of a lawyer friend: “it depends”. Each option provides its own benefits and comes with its own unique constraints.
In our example of trucks transporting a warehouse of boxes, horizontal scaling introduces more trucks, each handling a smaller load. If one truck encounters a breakdown or traffic jam, the others can still continue, ensuring the overall delivery process remains efficient and uninterrupted. Only the boxes on the impacted truck are delayed. But what if one of the boxes needing to be transported is too big to fit on a small truck?
Vertical scaling increases the size of the truck, allowing it to transport larger boxes and/or smaller boxes. While this approach may work initially, there is still an upper limit to much a single truck can carry. Eventually, you might encounter constraints such as weight limitations or road size restrictions, hindering further expansion. Furthermore, if the truck were to breakdown or encounter a traffic jam, there is a greater impact to the overall transport of boxes.
Going back to the digital world, messages processed through our APIs can be seen as the boxes, and our API workers are the trucks. When looking to scale our applications, we need to determine what our specific use case is, and what our priorities are. Are we handling large, complicated requests that require more processing power, or are we handling a lot of smaller independent requests? Do we need to prioritise throughput or redundancy.
How Mulesoft Can Help
Scaling in Cloudhub couldn’t be simpler. When deploying an API, we specify an allocation of workers and vCores for the API. Adding additional workers will scale our API horizontally, while increasing the vCore allocation will scale the API vertically. This allocation can be updated at any time with zero downtime. There have been several times where I have deployed applications that have turned out to be far more popular than anticipated, and I have been able to quickly and easily increase the number or size of workers as required to ensure the customer experience is not impacted.
Additionally Mulesoft has a few more tricks up its sleeve with Autoscaling in Cloudhub, CPU Bursting in Runtime Fabric, and Clustering in Cloudhub 2.0.
Auto Scaling in Cloudhub, and CPU Bursting in Runtime Fabric, allow us to set a base allocation of vCores to an API and setup rules that allow the API to automatically scale vertically as demand requires.
Alternatively, Clustering in Cloudhub 2.0 provides scalability, workload distribution, and added reliability via the scalable load-balancing service and replica scaleout features.
These features take away the need for us to monitor usage in order to keep on top of resource requirements. Where in the past I would quickly jump in to adjust applications, Mulesoft now takes care of everything for me, with the added advantage of scaling back as demand drops.
Other Considerations
At the end of the day, scaling is all about dealing with increases in demand, and handling spikes in traffic. Scaling the APIs themselves as discussed is the simplest solution but it is only half the story.
A well-crafted API architecture serves as the cornerstone of a scalable and future-proof application ecosystem. A robust API design not only enables seamless connectivity between different services but also empowers applications to evolve and grow organically over time.
Decoupling the various layers and functions of our APIs is a fundamental aspect of achieving this flexibility. By breaking down complex functionalities into modular, independent components, we create a system where changes in one area can be made without affecting others. This decoupling not only simplifies development and maintenance but also lays the foundation for scalability. With a well-structured API architecture, we can easily scale specific areas of our application, whether vertically or horizontally, in response to changing requirements or increased demand.
I recall one scenario where a client was experiencing degraded performance during a specific 15-minute period each day. It turned out that a large portion of their customers were all trying to submit the orders they had been working on that day before logging off at 5 pm. The backend database couldn’t keep up with the isolated spike in requests, and customers would get frustrated with the slow response times as they were trying to leave for the day. By reviewing the clients API architecture, and implementing a pub-sub queue in the process, customers were able to submit order requests to an API and immediately receive a response that their order had been submitted for processing. Meanwhile, another API would work diligently in the background to process the backlog of orders in the queue.
In essence, a good API architecture lays the groundwork for scalability by promoting modularity, decoupling, and abstraction. It empowers developers to adapt and expand their applications in a way that is efficient, reliable, and responsive to the evolving needs of users and stakeholders.
Next Steps
Curious about how MuleSoft CloudHub can transform your scalability challenges into opportunities for growth? We’re here to help you navigate the complexities of scaling your applications effectively. Reach out to us today, and let’s explore how our solutions can empower your business to thrive in a digital-first world. Connect with Adaptiv here and take the first step towards effortless scalability.