Developing a new product can be a nerve-racking experience. It’s an intense time, in which you take thousands of key decisions and look at your solution from all the possible angles.
You put so much thought into the process, it’s only natural that you want the launched app to be the final version.
Then, the market landscape changes, your customer base grows, you update your business approach to meet the current needs of your clients… Your business evolves, but your product stays behind. And there’s no easy way out.
So, what can you do to develop software that will serve you well now and in the future?
Three words — make it scalable.
What is scalability?
In the software development context, we usually define the term ‘scalability’ as the ability to provide the same or similar efficiency while handling more data, users, and traffic.
Having scalability in mind, architects and developers pay attention to:
The quality of user experience, for example, system response time;
The performance of the infrastructure — how the system manages a large database, long queries, etc.
Yet, scalability is so much more than the ability to handle traffic from one to bazillions of concurrent users and processes or storage space from nothing to petabytes, without downtime. Focusing only on the issues of CPU, memory, or storage doesn’t do it justice.
Scalability means the ability of your product to grow as the needs of your business change. Whether it’s a changing market landscape or an ever-expanding customer base, a scalable system will adapt to the current conditions.
Let's say that one day you decide to start a potato farming business. In the beginning, being a fledgling company, you sell your crops at a local market. It's not exactly a one-man operation, but it's relatively easy to fulfill your operational needs. Eventually, you get an opportunity to supply potatoes to grocery stores and restaurants. It's a big deal! But with great success comes great responsibility. Now, you need to take care of logistics, check which retailers are driving revenue, estimate crop yields...
This can only be done with the help of the right architecture — the one that's adequate to the problem.
What is the difference between vertical and horizontal scalability?
You can approach the issue of scaling your system horizontally or vertically.
In horizontal scaling, you increase capacity by connecting multiple hardware or software entities together.
Vertical scaling requires you to upgrade resources so the single instance can work better.
The vertical approach has more limitations — after all, you can only insert a certain number of disks into a computer. Horizontal scaling, on the other hand, allows you to cluster as many units as you want.
How to choose the right type?
There are fewer and fewer projects that require scalability in terms of traffic or amount of data. With the increase of processing power and storage — or drop of the price for memory, CPU, and persistence — it is much easier to scale vertically. This way, you can cover more projects with just resource allocation.
You'll need hands-on experience to choose the right scalability type for your project. And it is important to do so at the beginning of the project so you can decide on the tools.
Why is scalability an important factor in software development?
A short answer is that scalability gives you flexibility — you don't need to rewrite your code when a business requirement changes.
A scalable app is ready to accommodate new workload demands, deal with various types of data, or serve extra functions in the future. All of this without any downtime or lengthy response time — the common deal-breakers for end users.
Yes, we're all used to getting results instantly. Users expect a website to load quickly — the longer they wait the less eager they are to continue using your product. If your system is not prepared to handle an increased number of users, you might start to lose clients.
So, if you expect your product to keep evolving, become a success, and remain one — building a scalable web or mobile application is your safest option.
When is app scalability less important?
The truth is scalability, in one sense or another, is always important. Yet, there are some cases and stages of development when it's not a priority. For example, when your product is very niche, and the market has no potential to grow enough to exceed your capacity.
This is why you need to figure out what brings value to your business and customers first. Only then you'll be ready to take optimal short- and long-term decisions.
Do you have a great app idea? Terrific! Don't make scalability your number one priority just yet. It wouldn't matter much if you invested X number of weeks and a bag of money into ensuring app scalability but no one liked your app, right?
Start with finding your customers, getting to know their needs, validating your product idea, and creating value for your future end-users. App scalability allows you to deliver this value to a broader audience more effectively. It should be well-established and prioritized — but you should get to it only when the value flow already exists.
How do you know if an application is scalable?
It's not really the case of verifying whether the app is scalable — you should be looking at the entire system, including database and deployment. Usually, you find out that the app is not scalable, or not scalable enough, when it stops adapting to your needs. When your only concern is traffic, data, and resources — try performance testing before you get to this point.
Run different kinds of performance tests in the real environment, where you can hit the system with hundreds of concurrent users executing real-life scenarios, and gather statistics. Then, compare the load the system can handle with your requirements. At this stage, load testing tools — such as JMeter and Gatling — come in handy.
If you have performance issues on a particular path or very specific requirements for code execution time, run benchmarking on the code level with microbenchmarking tools like ScalaMeter. Such tools give you a guarantee on the process level that — during refactoring or other code changes — you don't break the time constraint for a particular function.
What aspects of development are important to build a scalable solution?
It's time to look at key aspects of app development that help you build scalable solutions.
Demands, requirements, and goals
Before you get to scaling, work out a feasible plan. Set your goals, decide how to measure them, assess future demands, lay down requirements, and anticipate potential changes in requirements.
The way you plan the infrastructure depends on the number of unique users you're expecting.
Let's imagine you're developing a VOD platform. If your goal is to reach 100–1000 unique users, scalability is relatively simple to achieve. Maybe you can do it incrementally? Perhaps you can be flexible and deliver better scalability over time? Now, if your product aspires to be another YouTube, it's an entirely different story. Just remember that solutions dedicated to big players cost big money.
System architecture
System architecture, not to be confused with the architecture of the application itself, is also an important part of scalable apps. Before you start building a scalable solution, decide on
Communication channels — asynchronous message-driven vs synchronous, for example, HTTP;
Database engines — different types and implementations scale differently;
Deployment — for autoscaling;
Fault tolerance; and
Programming language — some languages support parallel processing more than the others or let you use a CPU in a more tailored way. Some allow static typing while the others don't. You get the picture.
Development Process
Building scalable apps doesn't necessarily require a complex code or Herculean effort. As long as you have a clear, scalable development process.
Establishing the right process and scaling it when needed will work miracles and speed up the development.
Prepare well, analyze the domain or system upfront, and make sure you understand the problem.
How do you create a scalable application?
You should have scalability in mind from the very beginning if that's one of your requirements.
Align your needs and expectations with the architecture, technology, and maturity of software developers. Define the limit of scalability at which the application should work correctly. Revisit and recheck your assumptions and the overall architecture design systematically as you go. The worst enemy of any improvements is complacency and not challenging previous decisions.
Then, it's time for domain discovery and problem definition. If you outsource software development, your partner might help you make this step by organizing a series of workshops, like Event Storming and Architecture workshops. It's an effective method for modeling processes and defining critical sections, business constraints, and architectural drivers.
During development and on production, introduce performance testing and resource utilization monitoring.
Use languages and runtime that support asynchronous code execution and non-blocking IO. It will allow you to define different thread pools for different use cases.
Consider using serverless technologies — they will provide you with scalability out of the box, of course within certain limits. For example, AWS Lambda scales up even up to 1000 concurrent executions by default. Just write the code, and this serverless compute service will do the job for you.
How not to build scalable apps
There’s a fine balance when it comes to planning system scalability — you don’t want a system that’s overengineered. It’s difficult and expensive, not to mention unnecessary, to build and maintain software capable of handling thousands of users when you only have ten.
Also, it might turn out that you don't need some features after all, especially at the beginning of the system’s life. At this point, a good project manager should step in and decide what is essential and what is only a nice-to-have system function.
All in all, scalability can take your mobile app to the next level — as long as you approach it properly. Make sure you know what you want to achieve and always align your strategy with the requirements.
If you need help with a scalability issue, check what we can do to help you build a scalable app or get in touch to discuss your specific case.
This article was written in collaboration with Artur Bankowski (Head of Development), Marcin Wadon (Fullstack Developer), Michal Nowak (Entrepreneur), and Piotr Dzieciol (Project Manager).