Design Highly Interactive and Scalable Applications

Shadman Jamil
5 min readApr 20, 2018

--

What exactly does it mean to build a scalable application? At a first level, it is just connecting users with remote resources by using the Internet. The part that makes it scalable is that the resources.

When it comes to an application architecture, there are a few things which we need to consider: what are the right resources, how these resources will work together, and what are the right tradeoffs. Investing to how we can scale before it is needed is generally not a smart business approach. However, taking some time to plan when building your application design can save substantial time and resources in the future.

In early 2004, Facebook had about 1 million user base and now in 2018, they increased to 1.32 billion daily active users around. But users always demand to directed to their news-feeds/wall immediately to interact with their friends quickly and they do. That is called scalability in action.

Hotmail, Yahoo, and Google these are other giants among others, that have been scaled or can say scaled so well, that billions of users can access things easily and do not face any problem.

Most enterprises applications that need to have scalable will never be the size of Facebook, Hotmail, Yahoo or Google. However, the possibility of continuing increase of user base and load must be planned from start to place the correct scalable architecture is in place.

There are various principles to design a scalable application some of them you normally use and experiencing on different occasions; but you never thought about those in detail, here I am discussing few basic principles which I am sure will help you to design a scalable application:

  • Single Point of Failure — Never rely on one of anything, you should always assume and design things for having at least two of everything. This adds some cost but gives you an amazing availability and performance under load. Also, your application load will be distributed and enforce you to design your application with distributed-first mindset. Even when your any server degrades or fails, fail-over to a second can occur automatically as a failure of one server does not mean failure of everything.
  • Scale Horizontally — There is a limit to how large a single server can be. Even though databases are moving in the same direction too. In horizontal scaling, you need to consider it in your design with a distributed system architecture as there are some challenges with scaling because anytime you distribute your data or functions among multiple servers.
  • Services / Micro-services — Design your application as a service with an API. People these days are using smartphone applications, websites and desktop application more often and APIs helps you to make your service available for every client to integrate. If services do not sure which client will connect to it, then it will be able to serve all of them. Also by using ‘Service Oriented Architecture (SOA)’ you will be able to open your services for scaling and automation as well. You also may distribute your work in different services such as photos, authentication and CRUD operations for fast processing and availability which you call ‘Micro Services Architecture’. By introducing services in your architecture, you will be able to scale your different services’ server in a different direction per your service need.
  • Decoupling — Decoupling your functions or work that will allow your system more scalability, this also prevents the typical issues of your servers. When each node can function independently, your new nodes can be added easily without coordination to any central system or affect anything, so the scaling of your application will be much easier.
  • Cache — Caches plays an important role in high-speed processing, these are essential storage of pre-computed results that you may use to avoid computing the results over and over again. This is an advantage for scalability and performance, so you must consider this in your application design.
  • Maintenance and Design — System needs monitoring and updates to ensure proper operations and activities over time. As we have moved to ‘treat your servers like cattle not pets’ era, our minds should be changed. Do you even need to re-configure your servers anymore? Can not you just replace old ones with new ones, which have been configured offline as part of their image creation? Do not underestimate the effort and time you spent in maintaining your application. Your initial public release must be an extraordinary milestone, it also marks when your real work begins.
  • Asynchronous Processes — In applications to prevent the freezing of the users’ screen, and give them the impression that the process is taking some actions visually. Asynchronous execution will perform your processes in the background which will not affect your users’ other operations. For instance; if you want to implement a download a report process, you might use a synchronous process to do that but it will block your thread until the file downloaded. Also, this can make your application unresponsive to any user input until they receive a response from their previous request. Use asynchronous executions where you feel your request process time is increased due to some valid reasons.
  • Strive for Statelessness — This design principle that is applied in the service-oriented architecture in order to design any scalable application. The applications keep the interaction specific data as next interaction may depend upon the outcome of the previous interaction. This becomes more important in distributed architectures where the client and server do not exist on the same machine. In the two-tier architecture, the responsibility of holding interaction related data will be on the rich clients, as each client used to occupy space on an individual machine. However, within n-tier architecture, the state management responsibility moved from the client to the application or the web server. Treat your application servers as completely independent and replaceable, which will be a plus from a scalability point of view because your server can easily be modified and any of them will be able to handle client’s request.
  • Monitoring Tools (A TIP) — System needs monitoring and updates to ensure proper operation over time. You should set up some monitoring tools in your application server, in order to monitor your services as well as servers, as that will help you to improve your application performance more, similarly, those tools help you to monitor your infrastructure activities and usage of your resources.

You also may look at companies like Linkedin, Twitter, Quora, Whatsapp, Instagram, Slack and some other companies those are utilizing new technologies and how they are using it for high performance of their applications and scalability to handle a large number of users in an efficient manner. For as successful as other giants are.

If you can’t split it, you can’t scale it

Cheers!

--

--

Shadman Jamil

Tech Savvy, Software Architect, Mentor, and Entrepreneur