Tuesday, December 29, 2020

Questions to ask as a Manager that can make any idea better

 One of the key responsibilities of an engineering manager/direction/leader in any organization is to ask the right questions. Here is a list of questions to ask to make almost any idea better

  1. What does success look like and how to measure/track it reliably ? 
  2. How does this tie to the north star/mission/vission ? 
  3. Who are we solving for ? 
  4. What problem are we solving ?
  5. Recursively ask why is this a problem till you find the root cause. Always treat the root cause rather than the symptom. 
  6. What makes this challenging ?
  7. What is the P50 goal - 50% chance of hitting success and why is this a P50 goal
  8. What tradeoffs are we making ? 
  9. What is the cost benefit analysis of the tradeoffs ?
  10. What are the prioritization principles being used behind these tradeoffs ? 
  11. What is the opportunity cost of doing this over something else ? 
  12. What ideas are we not able to fund because we are funding this ? 
  13. What are the constraints we are operating in and what happens if fundamentally relax/change any of those constraints ? What is the timeline of the change of those constraints. 

Saturday, December 26, 2020

Volatile, Synchronized, Re-entrant lock, Condition variable

Volatile

  • The volatile concept is specific to Java. Its easier to understand volatile, if you understand the problem it solves.
  • If you have a variable say a counter that is being worked on by a thread, it is possible the thread keeps a copy of the counter variable in the CPU cache and manipulates it rather than writing to the main memory. The JVM will decide when to update the main memory with the value of the counter, even though other threads may read the value of the counter from the main memory and may end up reading a stale value.
  • If a variable is declared volatile then whenever a thread writes or reads to the volatile variable, the read and write always happen in the main memory.
  • As a further guarantee, all the variables that are visible to the writing thread also get written-out to the main memory alongside the volatile variable. Similarly, all the variables visible to the reading thread alongside the volatile variable will have the latest values visible to the reading thread.
  • Volatile comes into play because of multiples levels of memory in hardware architecture required for performance enhancements.
  • If there’s a single thread that writes to the volatile variable and other threads only read the volatile variable then just using volatile is enough,
  • however, if there’s a possibility of multiple threads writing to the volatile variable then “synchronized” would be required to ensure atomic writes to the variable.




Synchronized

  • Java’s primary tool for rendering interactions between threads predictably is the synchronized keyword. Many programmers think of synchronized strictly in terms of enforcing a mutual exclusion semaphore (mutex) to prevent execution of critical sections by more than one thread at a time. Unfortunately, that intuition does not fully describe what synchronized means.
  • Synchronize is more than mutual exclusion : The semantics of synchronized do indeed include mutual exclusion of execution based on the status of a semaphore, but they also include rules about the synchronizing thread's interaction with main memory. In particular, the acquisition or release of a lock triggers a memory barrier -- a forced synchronization between the thread's local memory and main memory. (Some processors -- like the Alpha -- have explicit machine instructions for performing memory barriers.) When a thread exits a synchronized block, it performs a write barrier -- it must flush out any variables modified in that block to main memory before releasing the lock. Similarly, when entering a synchronized block, it performs a read barrier -- it is as if the local memory has been invalidated, and it must fetch any variables that will be referenced in the block from main memory.
  • The proper use of synchronization guarantees that one thread will see the effects of another in a predictable manner. Only when threads A and B synchronize on the same object will the JMM guarantee that thread B sees the changes made by thread A, and that changes made by thread A inside the synchronized block appear atomically to thread B (either the whole block executes or none of it does.)
  • Furthermore, the JMM ensures thatsynchronizeblocks that synchronize on the same object will appear to execute in the same order as they do in the program.




Reentrant Lock

  • Java’s answer to the traditional mutex is the reentrant lock, which comes with additional bells and whistles.
  • It is similar to the implicit monitor lock accessed when using synchronized methods or blocks.
  • With the reentrant lock, you are free to lock and unlock it in different methods but not with different threads. If you attempt to unlock a reentrant lock object by a thread which didn't lock it initially, you'll get an IllegalMonitorStateException. This behavior is similar to when a thread attempts to unlock a pthread mutex.




Condition Variable

  • We saw how each java object exposes the three methods, wait(),notify() and notifyAll() which can be used to suspend threads till some condition becomes true.
  • You can think of Condition as factoring out these three methods of the object monitor into separate objects so that there can be multiple wait-sets per object.
  • As a reentrant lock replaces synchronized blocks or methods, a condition replaces the object monitor methods. In the same vein, one can't invoke the condition variable's methods without acquiring the associated lock, just like one can't wait on an object's monitor without synchronizing on the object first.
  • In fact, a reentrant lock exposes an API to create new condition variables, like so:

Lock lock = new ReentrantLock();

Condition myCondition  = lock.newCondition();

  • Notice, how can we now have multiple condition variables associated with the same lock. In the synchronized paradigm, we could only have one wait-set associated with each object.

Differences Between Lock and Synchronized Block

  • synchronized block is fully contained within a method — we can have Lock API’s lock() and unlock() operation in separate methods
  • A synchronized block doesn’t support the fairness, any thread can acquire the lock once released, no preference can be specified. We can achieve fairness within the Lock APIs by specifying the fairness property. It makes sure that longest waiting thread is given access to the lock
  • A thread gets blocked if it can’t get an access to the synchronized blockThe Lock API provides tryLock() method. The thread acquires lock only if it’s available and not held by any other thread. This reduces blocking time of thread waiting for the lock
  • A thread which is in “waiting” state to acquire the access to synchronized block, can’t be interrupted. The Lock API provides a method lockInterruptibly() which can be used to interrupt the thread when it’s waiting for the lock

 

Wednesday, December 23, 2020

Amazon's 2020 review

 In the beginning of the pandemic, I had published a post on "How Coronavirus will expedite the Amazonification of the world" and also had put my money where my mouth was, ie invested in Amazon. The other day I was reading an article on how marketplaces faired in 2020 and here are few highlights on Amazon

  • 3P Amazon marketplace added eBay's worth of sales to its GMV in 2020. 3P went from 200bn to 295bn. Overall GMV was up 42%. Marketplace share of Amazon GMV grew to 62%. 


  • Revenue for all business categories grew by 25%+ in Q3 demonstrating across the board strength


  • Amazon's marketplace is even more concentrated than Parreto principle would suggest. Just top 852 (.05%) of the sellers contribute 10% of the GMV, and top 12% of the sellers contribute 80% of the GMV. 


  • 18% of US GMV came from 2015 seller cohort showing stickiness in the platform




  • Amazon launched in 3 countries this year - Netherlands - March 10, Saudi Arabia - June 17 and Sweden - Oct 28th. Using auto-translated catalogues and reviews, the cost to launching new countries seeded with sellers already serving similar countries is too small. This will only expedite Amazon's international expansion. 
  • Ads revenue came in at 20 bn and advertising revenue as a share of marketing expense is steadily rising. This is similar to what Chamath had previously pointed out, Amazon thinks about making every expense item a revenue bullet point. 
References

Saturday, December 19, 2020

The Amazing Vaccine Race

 Few astounding facts which will be table stakes for the future

  • The digital copy of the virus from China reached America even before the biological/physical copy of the virus on Jan 11 thanks to the advances of Genomic Sequencing Tecnology
  • Moderna was able to design a vaccine with just the digital copy without the actual physical copy in a matter of 48 hours
  • The team at NIH and the team at Moderna had the exact same copy of the vaccine after they compared the results
  • At the same time they started to make a clinical grade product that could go into Phase 1 trials
  • The vaccine that was reviewed by FDA in December 17 was the exactly the same vaccine that was designed by Moderna in Jan

What is mRNA technology ? 

Its a molecule that exists in everyones cells that is like a xerox copy of the instructions of your genome to one gene at a time to make protein. 
When cells want to make insulin, it makes a zerox copy of the instructions from the DNA. Ribosome (like a 3D printer) will read the mRNA instructions and makes a protein adding one amino acid at a time. 

How to use mRNA ? 

Most viruses in life including COVID-19 contain mRNA. Through evolution mammals have developed mechanisms to recognize foreign mRNA. People abandoned and quit on trying to make mRNA as a drug. In 2010-2011, a set of academics at Harvard and MIT, played with mRNA. They believed that if you modify you can make an mRNA that is immunosilent. 

1 Protein of the virus - spike protein - this is the instruction that is being passed through the mRNA technology in the vaccine. The cell knows then how to create this protein. Then the body knows that this foreign protein is in the body and starts making antibodies. The spike protein sticking out the cell mimicks the real virus and the immune system starts fighting it.

How to know the Spike protein ? 

Spike is what the virus uses to get into the cells. Spike protein had been used to protect against MERS in animals. 

Future mRNA verticals

  • mRNA for Tumours
  • mRNA for heart 
  • Vaccines

Friday, December 18, 2020

Networking Resources for Engineering Managers

Engineering Management can be a lonely job. Also, people tend to get better at Management only with experience. In the journey, it can be very helpful to have a peer group of other engineering manager, with whom one can discuss, debug and learn from their challenges. This group can be ones mentors, sponsors, past managers, network of weak connections who can help in the Engineering Manager leadership development journey.

Below are the list of resources to hone and develop a network as an Engineering Manager. These resources can be helpful for high TLs or TLMs looking to convert to an EM role, new EMs to learn from each other's experiences, seasoned EMs to grow their network outside work : 

Sunday, December 13, 2020

Compounding M1 Money Supply

M1 acceleration(new)


1st trillion-80 years(1913–1993)
2nd trillion-18 years(1994–2011)
3rd trillion-5 years(2012–2016)
4th trillion-4 years(2017–2020)
5th trillion-6 months(Feb–Jul 2020)
6th trillion-4 months(Aug-Nov 2020)
7th trillion - 2 months?

 

Saturday, December 5, 2020

Airbnb S1 Analysis

Summary

  • Crazy effect of the pandemic shows what V shaped recovery looks like and revenue resilience
  • Healthy marketplace dynamics shows growth on both demand and supply side
  • Pandemic could still dampen growth rates in the coming 2 years
  • Company poised to grow and do well over the next 10 years aligning with new trends and making improving lives of guests, hosts and communities
  • Business has resilient revenue and durability due to 2 sided marketplace and local and global network effects

Key Metrics

  • 4 million hosts
  • 220 countries and regions, 100,000 cities, 55% hosts are women
  • 110 million guests cumulative in 13 years
  • 110 billion host earnings total in 13 years

COVID Impact

  • Airbnb business declined significantly during COVID and rebounded after three months
  • During Mar, Apr, May 2020, Airbnb Gross Nights booked crashed 42%, 72% and 50% respectively YoY. After that it has stabilized at -20% YoY.
  • Even though international travel has been limited, domestic travel has rebounded showing resilience of the business
  • As COVID, blurred the lines between work and life, it also blurred the lines between travel and living. A new trend has started "work from Airbnb" or a "Workation" which is Work + Vacation 
The below chart shows the crazy effect the pandemic had on Airbnb


Business and Strategy Commentary

  • Two sided market place with guests(demand) and hosts(supply)
  • Increase the supply of hosts
    • 79% of the hosts coming to the platform organically to sign up in 2019
    • 23% of the new hosts are converting from guests - this is a very healthy sign
  • Attract new guests onto the platform(Acquisitions) + Get the current guests to use the platform more (retention and resurrection)
    • 91% of the traffic came to AirBnB from organic or direct channels meaning acquisition cost can be negligible. The platform has good content which is driving users there
    • 69% of revenue was generated from repeat guests meaning guests who use the platform once like it and continue to come back showing the platform is healthy
  • These numbers really make the business likeable because there is low acquisition costs both on the supply and demand side. Hosts are getting economic benefits by monetizing assets, guests are getting choices to buy an wide array of experiences which is attracting both guests and hosts and making the marketplace stronger and stronger. 
  • International Expansion will be a future driver for growth specially in countries where penetration is lower like India, China, LaTaM, SEA. Has both local and global network effects
  • Categories  resilient to COVID
    • Domestic
    • Short distance stays - within 50 to 500 miles
    • Long term stays > 28 days
    • Travel outside the top 20 cities
  • Investing and developing the brand 
  • Create new experienes

Financials

  • 2.5 bn revenue in 2017, 3.6 bn revenue in 2018, 4.8 bn in 2019
  • For the 9 months revenue comparison is 3.6 bn vs 2.5 bn in 2019 vs 2020
  • Net loss has been 70mn, 16mn, 674mn in 2017, 2018 and 2019
  • Cash in hand 4.5 billion



Bay Area is Dead - Look at the IPO class of 2020

Look at the IPO class of 2020
  • Airbnb - Airbnb S1 Analysis
  • Asana - a work management platform
  • Unity - a 3D video game dev platform
  • Snowflake - a data warehousing startup
  • Palantir - Peter Thiel's data products startup for gov
  • Sumo Logic
  • Doordash
If we just include Airbnb and Doordash, they have 150 billion worth of market cap after first week of trading. If we assume even 10% of that went to employees, thats 15 billion of liquidity coming to the bay area only from these two IPOs. Even at half the valuation, its will create a new crop of home buyers, new seed rounds, new angel investments that will plant the seeds of the future IPOs. 

Also there has been lot of talk about HP and Oracle leaving the bay area. In all fairness, Bay area left these companies long before they left Bay Area. It was hard for them to hire talent in a competitive market given their brand, vision and strategy. Also given their uncompetitive pay, very hard to see why folks will prefer them over companies with the chance of going IPO. I think in the short and medium term, it is great news as they will make room for other new startups to secure leases in the bay area. 

Wednesday, December 2, 2020

Influence over authority

To influence without authority, ask yourself:


1) What do I want them to Know ?

2) What do I want them to Do ?

3) How to do this ? 

4) What do I want them to Think About?

5) How do I want them to Feel?


Want to force ? Come across as authoritative or directive style of management

Fixate on 1, 2, 3. Yields short term results. 


Inspire and Influence ? Build for the longer term and hone everyone's drive, passion and agency

Focus on 4 and 5. 

Read more about Influence : The psychology of persuasion .


Books I am reading