Smartym Pro  /  Blog  /  Innovation  / 

What is a reactive architecture. Review of reactive systems

 

For the past two years, the requirements to mobile and web products have become much more strict. The main reasons are an increasing competition and growing number of app users Considering the mobile app market, users downloaded 178.1 billion mobile apps in 2017. This year, the number of installs is 205.4 billion, according to Statista.

 

At the same time, applications are being widely adopted by businesses for various reasons: to improve the customer service, automate workflow, increase the employee performance, and so on. Popular international e-shops, Uber-like taxi services, messengers, banking apps, and other solutions need to have the continuous functioning and be able to handle high loads.

 

Just several years ago, even large applications could have a response time of a few seconds and offline service could last for hours. Today they can’t afford having such troubles. While the number of users, data, and devices is growing, successful apps can work on everything, have an instant response time, and can process thousands of events per second.

 

If earlier such strict requirements were applied to giants like Twitter, SnapChat, Facebook, and Google, now they are coming into force almost everywhere. Banking and financial organizations, large telecommunication and retail companies, international travel agencies, and others are taking care of meeting the user expectations.

 

To achieve high levels of scalability, flexibility, and resilience, they use a reactive type of architecture. Applications developed on its base are called reactive. Reactive architecture enables developers to build more fault-tolerant and responsive solutions that can work offline.

 

The key characteristics of reactive systems

 

  1. Responsive

 

Responsiveness is about ensuring a quick and constant response time and providing a consistent app functioning. Responsive systems imply a rapid problem resolution and effective error handling. Having this characteristic is essential for high product usability and reliability.

 

  1. Resilient

 

Resilience means that the system responds even in case of some failure. Resilient systems have failures contained within each component. All components are isolated, so, if some part fails, it doesn’t compromise the entire system and can be recovered without affecting it.

 

Noteworthy, that recovery of each component is delegated to another one, while high-availability is enabled due to replication (where it’s needed). Isolation, delegation, and replication are those things that help make the system resilient to failures.

 

  1. Elastic

 

Elasticity is another characteristic of reactive systems that implies that app continuous to successfully respond under varying workload even when it becomes very high. The system reacts to changes in the input rate by increasing or decreasing the resources – depending on the necessity – required to service these inputs.

 

It has the ability to shard or replicate the components and allocate inputs among them. Even if the loads dramatically increase, for instance, in the case of popular international e-shops on Black Fridays, the app works due to its elasticity.

 

  1. Message driven

 

Message driven is a characteristic that differentiates apps having reactive architecture from others. A reactive system uses asynchronous message-passing which establishes boundaries among individual isolating components.

 

Applications that use this asynchronous model provide much better connectivity than those that are based on purely synchronous calls. The sender and receiver can be implemented without looking behind the details on how events are allocated in the system.

 

Event-oriented (message driven) reactive systems provide loose coupling of the components and subsystems, increasing the app scalability and fault-tolerance. Without complex and strong dependencies between them, the system expansion requires minimal efforts.

 

Thanks to that, interfaces can focus on the broadcast content, resulting in the implementation that is easier to change and maintain. In such an application, all the components interact with each other by sending and receiving messages in asynchronous and non-blocking mode.

Asynchronous and non-blocking

 

Asynchronous messaging means that an application has a high degree of competition and can work without changes on a multi-core architecture. Any CPU core can process any message, which provides more reliable functioning.

 

Non-blocking means the ability to continue working so that the application is responsive all the time, even in conditions of failure or peak load. To do this, all the resources required to ensure responsiveness like CPU, memory and network, shouldn’t be monopolized. As a result, you get a lower latency, greater bandwidth, and better scalability.

 

Traditional server architectures use a shared state of change and blocking operations on a single thread, which complicates the system extension.

 

By separating event generation and processing, you make the platform take care of the details of synchronization and dispatching events between threads, while concentrating on providing higher-level abstractions and business logic. Also, you can pay more attention to the way how the components interact with each other.

 

To enable the solution high performance and scalability, the architecture must be fully message driven, from services, cache, and databases to user requests sent via a graphical interface, e.g., a browser, and their processing.

 

If at least one of these things doesn’t meet the requirements of reactive systems, for instance, making blocking requests to the database, causing expensive synchronous operations, etc., the users will suffer from increased delays and dropped scalability.

 

Thus, the use of a reactive architecture leads to the cost reduction, an increase in the processor resources utilization, and providing the end customers with a good non-blocking service.

If you have some questions about the topic, need to choose a type of architecture for your application, or have a project idea, we’re here to help! Specializing in custom mobile and web app development, we’ll be glad to provide you with a free consultation. Feel free to contact us!

author avatar
Smartym Marketing Team