Monolithic vs Decoupled Schema


Let us understand what we mean by Monolithic and Decoupled architecture, Schema with an example.

Setting up a library

Let us take example of library. A new library is opening up. It would have many books, may be on various subjects. First task for librarian is, to store the books in library.

Librarian started with obvious approach first, i.e. start putting all books in shelf, one after other. It was quick. She puts all the books quickly in the shelves; and created an index to search any book.  




Benefits:
  • It was quick, easy, and less work. Just one simple storing strategy, every new book will go to next available space.
  • You have all sort of books at one place, which means just keep updating one index for every new book – no need to maintain separate indexes.
  • Readers can find all sort of books at one place for all of their tastes. They need not to go to multiple places. Just iterate over and you will find what you need.
  • For librarian, access management is easy. Anyone having access to library, can access any book easily. Less time spent on management.
  • It is easy for readers to refer any other related book also. For ex: if you reading astronomy book, and need to refer a math book. It might just be somewhere in same row.

All setup done. Things started rolling. All good so far. Eventually library become popular and started getting more readers and requirements for new books. Librarian started ordering more and more books on various subjects.

Challenges:

However, as volume of books increased, Librarian started observing few issues. Like:

  • Readers: Mostly readers have interest in one or two categories of books. They just look for these, and not for diverse set of books.
o   However, as all the books are placed in one bookrack, it was time consuming for readers to look for relevant book, and to understand the whole big library index.
o   They were spending more time on searching the right place of information, rather than reading the actual information.
o   Few of the readers started logging their frustration too.

  • Readers & Librarian: Whenever there is a new lot of books or existing are getting old in library, librarian need to rearrange the books. Because it was one single category, it means that whole index chart needs to be updated every time.  
o   Readers: It was demanding for them to learn new changes again and again due to the size of library, even when they are not really reading books from affected categories. They are spending time to readjust to new changes, even when they are not really related to that change.
o   It was also demanding more time from librarian, because whole index chart needs update, more work.
  • Librarian: Once library founder ‘the one who is investing’ asked to put some books at priority window, librarian has to obey. But, as there are lot of books, many readers, she was very busy and was really out of time to update the whole index.
o   As there is a single inventory or index, librarian either need to change the whole index of all books, or will keep it dirty for whole set of books.
o   She fall back to second option of keeping it dirty to follow the orders. But that means index is disturbed for whole library. Would have been limited to  one category, in case if we have categories.
  • Librarian: Reader A comes and ask for a book of history.
o   It took librarian bit of time to look for that specific book. Reason, even if we have index, but the index itself is huge.
o   Librarian, being a human being, is limited by her own capacity to go through with that massive information of indexes or domain knowledge.

Gradually librarian figured out that current structure is becoming difficult to manage. She learnt from these findings and rearranged the books, this time based on categories.


Revised structure

Now library has various racks named based on category of books, like Math, Science, Management, Astronomy, History, Finance etc. A comparatively much smaller index is maintained for books, which become easy to remember, recall. Even a smaller index is maintained for racks as well.




Results, with this one change, most of the above challenges were resolved.  
  • Readers were very happy as they were able to find a book quickly and easily.
  • Librarian is also happy now as it reduced her work a lot, lesser long queues. She can respond to changes quickly with lesser impact area.
  • Any new Reader can easily understand the structure, as it is smaller.

Overall, lesser work for Librarian and Readers both, More productivity and quality time spent on real work which is studying.

Ball starts rolling, things were moving good. Gradually librarian figured out more points.

Added benefits:
-          
  • For Readers:
o   Readers are spending more productive time on doing actual reading. Earlier they kept on waiting for where to find the right information.
o   Readers can refer to index themselves easily, as it is much smaller and easy to navigate now. Earlier they were mostly confused and were keep on waiting for librarian for every new need.
§  Whole system is moving towards self service mode, reducing dependency on one point.
o   New readers, who mostly focus on one category of books, were able to understand the index fast – even if they are lesser experienced in library system.
§  Reason, information is in much smaller pockets for them to digest.
o   One great silent point for improving productivity, earlier readers use to distracted by non-related information also easily as it sits next to the main book. They usually spend lot of time just looking at books i.e. lesser focus on main reading.
§  This was improved a lot, as now there is no obvious scope of cross-referencing and distraction. Much cleaner approach to study.
  • For librarian,
o   Changing the index structure based on any special need, become much easier, due to size and reduce dependencies.
o   Index system also become much easier, as it is designed for one specific category, for specific needs of that category. 
§  Lesser collisions, or smaller size indexes.
o   It become easy to manage the changes, and the after impact on readers. Change in one category was not impacting the readers of other categories.
§  Lesser waste of time on managing emotions and complaints.
o   Maintenance activities like Tallying the books and indexes become easy, as now librarian can do it category by category, instead of going big all the time.
o   Any dirty work due to any special need was limited to one category only, was not impacting the whole system.

Innovation, Evolution to next Level

What more, as changes can be contained to one small section of books now,
-        
  •   Librarian even found it easy to experiment various new technologies now.

o   Ex: Librarian noticed that Readers of computer category were mostly asking for e-books, CDs. She decided to experiment and brought in an E-books system for computers with audio devices, replacing hard copies. It saved space. Readers were also happier.
o   This change was only possible because change was limited to one book category, one rack. Librarian may never experiment this, if it has to be done for whole library.
  • Once computer’s books moved to e-books system, librarian even moved ahead to make it available 24 hours by exposing it on internet.
o   Rest of the books still accessed in manual mode, when you are in library physically.
o   Hence, it become possible now for each category to have its own protocol of access, without having dependency or impact on other.
o   Increased scope of innovations, experimentation


Challenges and Solutions for Revised Structure

There were very few cases when previous system of mixed categories seems better, like:
  • Some experienced readers, who usually cross-reference, and read more than one category of books, find it easy to have all books at one place, as it was easy to pick the books.
o   Solution was to make indexes handy so that they can quickly refer to other categories.
o   And a little efforts on educating that new system is easier for bulk of the readers and for maintenance also.
  • Some experienced readers were not finding it easy, as they need all related books at one place to read easily.
o   Solution: Check for specific use cases of these users and make a special rack which contains all of such taste books (may be a copy).
  • Auditors question was, how can I see the all the books in one go now, overall books auditing.
o   Solution: Books are still there in library, the only change is the rack. These racks are placed next to each other and are approachable whatever way it can help.
o   Further, we can copy and paste index or usage data of all the categories at one place to refer.

All of these challenges also mitigated gradually. Overall, librarian, Readers, Management, Maintenance staff, all are happier now with a change in how we store the books.

Now let us refer back to terms to map with Software Development:
-        
  •   First library system > Monolithic Architectural pattern
  • Improvised library system > Decoupled pattern
  • Librarians > DBAs, Developers
  • Readers > Developers, Micro-Services
  • Auditors > Business users
  • Experienced Readers > Users who are using this system since long and are well versed with this structure.  Who are much experienced in system over the years and hence can remember and process all of information effectively.

* Credit goes to my wife, the co-blogger, for tossing this example :) 

People who read this post also read :



0 comments:

Post a Comment