Distributed Datastore Basics

Basics:
  1. Distributed DB is divided into different nodes & Data is spread across the nodes. 
  2. There is no Master/Slave config in distributed DB. 
  3. Every machine is given the responsibility of saving part of the data based on some logic.
  4. If some node goes down its fine since some of its data is captured into some other node. 
  5. Primary responsibility of a node is to store all the data. Secondary responsibility of another node(backup) will be to store part of that data. So a primary node will store all the data and several secondary nodes will store parts of the data. In case of loss, data will be retrieved from several secondary nodes.
  6. Consistent hashing concept is used to distribute the data across several nodes.
    1. It will determine the hash of data and spread it across different partition keys. 
  7. Primary datastore will take care of hashing the partition key and finding the respective node for storing it.
  8. In No-SQL datastores like Cassandra there is a replication factor, which is usually a number. Let's say replication factor is 3 then the data will be stored onto 3 different nodes. 
    1. Let's say the backup strategy is to store the data into the next available node. So in that case the data will be stored in the computed node, then next available node, then next available. 
    2. So its a combination of consistent hashing and backing up the data into different nodes. 
  9. To handle more load extra nodes will be added. This will automatically assign the responsibility of the distributing the data across new and existing nodes using Gossip protocol. 
    1. All nodes talk to each other so they everything about each other. 
    2. If a node goes down it will not hear or talk anything. When other will communicate to it there will be no response. They'll understand that the node is down so they will share the responsibility amongst themselves automatically. Another node will become primary node to hold the data of that range let's say 10-20k. 
  10. Similar strategies are implemented in Redis, HDFS, Cassandra, 
    1. HDFS has master node/name node and data node. Data resides in the data node. 
    2. In such cases ZooKeeper can take care of assigning responsibilities to slave nodes if master goes down. 
  11. Commodity computers are like normal desktop that we use at home but with extra capabilities. 

    Why you need to scale?
    Performance is degraded as customers are complaining that requests are taking more time.

    Vertical Scaling: 
    Upgrade the server to handle volume of requests easily. Upgrading single server's capability much more. 

    Horizontal Scaling:
    1. Add more machines to the cluster. 
    2. Cheaper than vertical scaling. 
    3. If service is not heavily used then more machines can be removed from the cluster. Service is not impacted since you are adding more machines to direct the traffic and removing the machines so requests are served by some or the other machine at any given point.
    4. Moreover, we can store the machines in different continents. 
    Conclusion:
    1. Vertical scaling is cost efficient in short term as you are buy less H/W. Horizontal scaling is cost efficient in long run. 
    2. Vertical scaling is not fault tolerant as its only one machine. 

    Advantages of distributed systems: 
    1. Fault tolerance:
      1. If server in a country goes down then requests can be directed to another server in another country.
      2. User will see more latency but the service remains available. 
    2. Low Latency:
      1. You can place the server near to where most requests are originating in case of HS but in VS there is only few servers so users will wait for their response. 
      2. Time taken to send and receive the request will go down. Only time consumed will be the time taken by the service. 

You might also like:

How to answer behavioral questions?

 Why should we hire you?

  1. To answer this questions, specify why are you a good fit to the role and the company. 
  2. If you doing some volunteer activities and if it matches the responsibilities of the company then you can specify that. For example, I regularly volunteer at 'X' organization. It requires me to work on some many things at the same time like marketing, sales, event planning, people management, resource management. I enjoy doing all of these activities at once. This role requires me to handle people & marketing hence based on my volunteer experience, I believe I am a good fit!


Why are you leaving your current job?
  1. To answer this question, don't specify that you are bored at your current organization. Instead specify something like this: After being there for 3 years, learning has slowed down. Company isn't growing that much and it is impacting my growth. 
  2. If you are looking for stability then mention that. If you are looking for a role with specific skills then mention that. 
  3. Always mention something along the line of what you want to do and how the current organization is not offering it!


What do you like to do in your spare time?
  1. To answer such questions try to come across as someone who shows initiative & who is willing to try out multiple things. 
  2. These days the roles are not one-dimensional. Instead they are multi-dimensional and expect people to have experience in wide variety of areas. So mention something like: 
    1. Working on a side project
    2. Volunteering
    3. Online learning 
    4. Hobbies
    5. Working out, cooking, etc


Where do you want to see yourself in next five years?
Interviewers ask this to:
  • Understand if you really want this job.
  • See if you have any plan for the future! 
  • Test your ambition. 
  • Ensure the company can give you what you want. 
Answers can include that you want to be a Lead person of a growing department or organization within the company. You might want to be in a specific domain. So to answer this question always have a 2,3,5 year plan ready. If you are interviewing for a higher roles then have 10 year plan ready! 






Product Manager Q&A

What is the best way to interface with customers? 

  • Face to face meetings
  1. I believe face to face meetings are the best if you have the luxury to meet your customers. During your f2f meetings, you can see how your customers are using your product and you will be able to gain some valuable insights. 
  2. For ex: If you have a business product then ask for customers for the flow diagrams that include your product in the flow. Ask them about any client proposals that they are working on and have worked on. Study those as nuggets of information can be found there. As a data PM, it is always useful to read these plans to understand how and where your products are used.

  • Phone calls
  1. If f2f meetings are not possible then go with phone call. Try to schedule a regular phone call with your customers to understand the pain points. 
  2. Ask them directly: Is there something you would like us to improve for you. What works best for you? What needs to be improved? Most often they have their answers ready.

  • Emails
  1. In come cases, just the emailing works. If this is the case then make them a priority and respond them within reasonable times. Sooner the better.! This shows them they you care about delivering a quality product. 
  2. If they are requesting a feature from you and you know its going to take time, try to be open about the timelines. Ask them if there is anything they would like you to do while the much needed feature is in process. This softens the customers a bit and they are open for negotiation. 

---------------------------------------------------------------------------------------------------------------------


What's the best way to work with the executives?

  1. Executives are busy people and they appreciate brevity. What is important to you might not be important to them. So we always have to be mindful of their time. 
  2. They care a lot about strategy than tactics. They care about business and product goals more than day to day execution. 
  3. Any suggestions that move the needle in direction of business goals will gain their attention. So to make any interaction valuable with them, focus on strategy and tell them on how you can help them better achieve the goals.
  4. While talking to them its important to talk about revenue generation, strategy, important KPIs that relate back to strategy, product metrics that are helping achieve the KPIs.
  5. While working on a problem, they are looking for solutions and which solution will work best for them. They usually care less about day to day execution but its best to have that information handy when asked! 
  6. Don't provide wrong answers to them. If you don't know, tell them you will get back to them after looking into it.
To summarize while working with executives:
  1. Talk about:
    1. Strategy
    2. KPIs
    3. Business and Product Goals
    4. Solutions to existing problems. 
  2. Avoid talking about: 
    1. Tactics
    2. Only problems
    3. Wrong answers

---------------------------------------------------------------------------------------------------


What's your approach to hiring? 

Hiring the best is always the motto of any organization but other dimension to hiring is 'How well this person will solve the business problem at hand'. Here are few common dimensions to consider while hiring: 
  • Business goals
  1. Let's say my team is really swamped and they could use some help then I will hire someone with specific skills set. I will work with the team manager to identify a specific skill-set that will benefit the team. And if I know exactly what projects we have to deliver and if we get a person with the exact skill set then I will go ahead with that person.
  2. However if I am hiring for an long term business goals then I will hire someone with determination and eagerness to learn. Someone who might not have demonstrated bigger professional achievements but is willing to explore and take on challenges.  I will look for someone who has done some projects on the side that explains their motivation to try new things and new challenges.

  • Cultural fit
  1. Every organization is different. I will conduct cultural fit interview based on situation. If company is fast paced then I will pick a candidate who likes such an environment. 
  2. If company is stable and not looking for much innovation then will pick a candidate accordingly.

  • Love for company's product offering
  1. It best to see if they are interested in company's product offering. If someone hates the company's product then there is no point hiring them. Their work will reflect it in the product. If they are not doing it with love then why affect quality of the product. 


----------------------------------------------------------------------------------------------------------------------------

How do you know an industry is ripe for disruption?

These points can provide some insights into it. But they are just the pointers, you will have to do some research to strengthen your insights. 
  1. Power is consolidated
  2. Consumers are using outdated Technology
  3. Business pratices aren't changing despite -ve feedback
  4. The research backs you up
  5. Reference: Link
----------------------------------------------------------------------------------------------------------------------------


In 2 mins, describe what a PM does. 

  1. A PM is a person who works tirelessly with different departments to constantly fill in the gaps that arise while product development, research, testing, legal, operations, resourcing teams etc. 
  2. PM works with the Legal team to fill gaps between technical teams and Legal fine prints. 
  3. Works with procurement teams to ensure appropriate deals/tools/resources are procured for the product to be delivered in time.
  4. Works with Engineering to translate business requirements to technical requirements. 
  5. Works with Executives to keep them aware of progress and assures them their business goals and key KPIs are achieved. 


NoSQL

This one is reviewed but I need to delete its copy from hubpages or somewhere NoSQL Data models: key-value  Aggregate model.  key or i...