Cloud Design Patterns — I

Nuwan Tissera
3 min readApr 18, 2020

--

Reusable solution for a recurring problem

Design patterns are kind of templates used to solve a problem. It also can be defined as the best way of approaching the problem. Maybe the best way found so far. Design patterns also improve communication between developer and architecture. Because it's easy to understand rather than a complex architecture. If we have the understanding of the template used to build it.

We will discuss some design patterns with its usage, implementation, pros and cons

Cache Aside Pattern

Load data into cache from the data store. It determines whether the item is currently available in the cache. If not, it reads from the data store.

The advantage is there when it comes to performance in this pattern. Performance in the sense, Read and write.

The disadvantage comes when maintaining consistency between DB and cache.

There are many solutions available like Redis Cache, AWS ElasiCache, Google Memcache and Azure also have an implementation of them.

There are few things we need to take into consideration on caching like what to cache, cache lifetime, cache size, evicting or removing cache etc.

Competing Consumers Pattern

Here, Multiple concurrent consumers are processing messages received on the same channel.

The goal of this design is to achieve scalability, availability and load-balancing.

The issue here is we cannot guarantee the execution and its order. The order may get sightly change.

So this is best for tasks that are independent but can be processed parallelly.

This can assure high availability of the service with a considerably high amount of volume (requests).

Here we have considered about maintaining the queue size, queue scaling, minimizing losing packets in the queue, mitigate poison/malformed messages etc.

Queue-Based Load Leveling Pattern

This is also a message queue with a specialization. The goal is to smooth the sudden heavy loads in traffic that are unpredictable. If we directly allow huge unpredictable traffic to service it will be a timeout or denial of service. Here queue can act as a buffer.

Priority Queue Pattern

Prioritize requests sent to services so that requests with a higher priority are received and processed faster than those with a lower priority. This pattern is useful in applications that offer different service level guarantees to individual customers.

It keeps several queues depending on the priority level as below.

Pipes & Filters Pattern

Decompose a task into separate elements that can be reused. Here complex task to decomposed into small components.

The goal here is achieving performance, scalability and reusability. The key advantage of the pipeline is to spread the load and maximize throughput because slow filters can be run parallelly.

In here, the time taken to process a single request depends on the slowest filter on the pipeline.

We will discuss more on another set of patterns in another article... Thanks

Clap if you liked...

References

https://docs.microsoft.com/

--

--

Nuwan Tissera
Nuwan Tissera

Written by Nuwan Tissera

Software Engineer WSO2 | Msc in CSE UoM | Blogger

No responses yet