MicroService – Brief Introduction

This post will focus on what Microservices are, why is it so famous these days, what are the positive and negative aspects of these services and what all area we will try to cover in future posts.

In addition, will share few youtube links, which are quite helpful to understand this concept. As a developer, I will say it is just one of the way how well we are packaging or modularizing code.

First of all, I would like to tell you, that I am inclined toward MicroServices, so most the things you find here will kind be in favor of these.But I will discuss all the challenges which you might face when you try to follow the awesome journey of MicroServices.

What is Micro Service?

Rather than going for a definition we will try to find the what are the common characteristics of Mirco Services.

In simple terms, you can think of a very small independent project capable of performing all the task.So If in a monolith you have various responsibilities, let each of this responsibility as a separate service.What responsibility does not have any concrete boundary. So this lets to the rise of the new question, how big or how small the micro services should be.Some people says it should be small enough to be handled by one developer, some say it should not be more than then few hundred line of code.To solve this, we will term service as a micro service if they have few of the properties/characteristics mention below.

Characteristics of MicroServices

  • Can be upgraded or rewrite independently.
  • Have fault tolerance and monitoring mechanism.
  • Each service is a complete Product.
  • Should have their own Data Management.
  • Should be easily replacable.
  • Should only expose the endpoint to dependendant services.

 

What a fuss is this, and Why is it becoming so popular these days?

As we all know that it is simple to solve number of small problems and then join all of them to solve the bigger problem.What we call is devide and conqure. Only problem in this approch is we need a very good merger technique to have a successful solution.With Devops of today(Docker,Kubernets,Mesos) it have been made possible to developer to manage large number of services and there deployment.Even it has helped to increase the resource utilization , which have further decreased the cost of maitaining multiple services.

Pros

  • It break the problem into smaller problem, helping developer to solve it more accuratley and in most optimized manner.
  • Partial Deployment and Partial Upgradation of Application is possible.
  • Help to reduce the develoment time.
  • We can easily rewite any service .
  • Services can be written in any programming languages , and we can easily try new progamming language.
  • Easier to find and fix bottleneck in the system.
  • Maintainance and Bug fix can be simper.
  • Test scope increases as we have to test smaller units independently.
  • CI/CD can be implemented easily.
  • Preserve modularity.

Cons

  • It increases the Devops activities.
  • Organization have to monotor and handle large number of sevices.
  • Service Discovery and trackng of request can be tidious task.
  • Need change in Oraganization culture.
  • Developer have to work more closely with devops , in order to make the development more stream line.
  • Need advance Devops.
  • Since it is kinda a new, not every one have clear idea what is a baoundary of MiroService.

Some Great Videos to give more insight.

 

Topics to be cover in upcoming blogs

  • Modules vs Microservices
  • How to share domain between different micro services
  • Should we have a common DAO[Database ] layer for every service or each service should have their own DAO layer?
  • All micro services in single Git Repo or they should have separate Git Repo
  • How to do monitoring of Micro Services.
  • How to track the flow of any particular request in real time between services.
  • Containerization of micro services.
  • Creating an environment of  Containerization service, which is self-deployed.
  • When to go for Micro Services.
  • How to shift from Monolith to Microservices.
  • How to perform Integration testing involving couple of Microservices as dependencies.
  • Distributed logging for Services.

Hashing And Different Techniques

What is hashing why we need it?

Consider it as a process of converting any input to an integer value.A string can have a hash value, a java Object can have hash value.

We need it to place these input to particular cell or bucket.So that whenever we need to find this object, we will find it in particular cell or bucket only.This will decrease the search time for an input object.

Click here to understand this part via youtube tutorial

Good Hashing Techniques

Since we need to convert the input value to some integer value, method or step to convert it should be simple and faster, as a user should not spend much time and effort on the secondary task.The second thing you should keep in mind is that your function should create different int value for different input for maximum cases.Otherwise, you will end up keeping elements in single or only a few buckets which will make search more problematic.

Two thing you have to learn is

  1. Event Distribution and Easy Computation
  2. Collision Detection and Resolution
  3. Collision resolution
    1. Linear Probing
    2. Quadratic Probing
    3. Double Hashing 

This is a minimum of hashing everyone should know.Will try to cover the hashing in depth in my upcoming blogs.

ThoughtWorks-interview experience

Got a call from a consultant,

I am sharing my interview experience for the same with you.

  1. Telephonic [30 mins]
    1. Current Project, and how PMS work internally.
    2. The difference between quick sort and merge sort.
    3. Which sorting did java use internally?
    4. When to user Interface, and Abstract classes.
    5. How to make class Immutable, and if immutable class contain a list, how to handle it.
  2. Coding[With Laptop coding]
    1. Write a program to full fill following problem: two(times(three())) or nested cases also.All the operator should be there.[logic was important].Click Here to get the complete code of this problem
  3. Coding[With Laptop coding]
    1. Write a code to compute the cost of the checkout cart, have many items with quantity, the group of items can have the special price. Every item has there individual price.[Focus on domain design]
  4. F2F Interview
    1. Current project design, architecture, your role.
    2. Difference btw soap and rest service.
    3. Domain design for a ROOM.
    4. Multi-thread simple question,
    5. DB designing simple.
  5. F2F Interview
    1. this was more of a discussion rather than the interview, more related to culture and personality.They will try to understand who you are, what are your goals.Are you  right person or not for ThoughtWorks
  6. F2F Interview
    1. It was related to the 3 pillars that ThoughtWorks build on, and try will try to understand your point of view on various social issues
  7. Aptitude Test
    1. There are around 50 questions, you  have to complete as much as question in 12 min
  8. Logical Test
    1. There are 13 question which have to completed in 1 hour.
A major focus will be given to Domain Design, how the class is created and how the will interact.
OOPS, concepts are important.Name of the classes matter.
If really want to crack Thoughtworks, please check few books.