Skip to main content

What are CAC, LTV, PBP in marketing?

· One min read
  • CAC: Customer Acquisition Cost is the cost to convert a customer to buy a product/service.
  • LTV: Lifetime Value is the estimated net profit we can make from a customer.
  • PBP: Payback Period in capital budgeting refers to the period of time required to recoup the funds expended in an investment, or to reach the break-even point. An ideal PBP is about 1 year.

LTV:CAC Ratio

LTV:CAC Ratio helps you determine how much you should be spending to acquire a customer, so that you can achieve sustainable growth.

  1. 1:1 = lose money the more you sell
  2. 3:1 or better = good.
  3. 5:1 or higher = under-investing in marketing

Mark Sellers: Technology Is Not an Economic Moat

· One min read

==Economic Moat== refers to: A company's ability to maintain a competitive advantage over its rivals, protecting long-term profits and market share.

Elements that do not constitute an economic moat:

  • Technology. Technology will ultimately be replicated.
  • Extensive reading. ==Reading can only help one keep pace with others.== In the industry, everyone reads a lot of books; even reading more than others does not necessarily make you more competitive.
  • Master's degrees or other degrees from top universities. These degrees often lead to high salaries, even if they are in stark contrast to what successful investors do.
  • Experience. Some degree of experience is necessary to participate in the economic game, but in certain cases, this experience may not be helpful.

Elements that constitute an economic moat:

  1. Economies of scale and scope. For example, companies like Walmart, Home Depot, and Lowe's.
  2. Network effects. For example, eBay and Mastercard.
  3. Intellectual property, such as patents and trademarks.
  4. High customer switching costs. For example, Paychex and Microsoft.

Public API Choices

· One min read

In summary, to choose a tool for the public API, API gateway, or BFF (Backend For Frontend) gateway, I prefer GraphQL for its features like tailing results, batching nested queries, performance tracing, and explicit caching.

JSON RPCGraphQLRESTgRPC
UsecasesEtherumGithub V2, Airbnb, Facebook BFF / API GatewaySwaggerHigh performance, Google, internal endpoints
Single Endpoint
Type System✅ as weak as JSON
No uint64

No uint64
✅ w/ Swagger
No uint64

has uint64
Tailored Results
Batch nested queries
VersioningSchema ExtensionYes, w/ v1/v2 route sField Numbers in protobuf
Error HandlingStructuredStructuredHTTP Status CodeStructured
Cross-platform
Playground UIGraphQL BinSwagger
Performance tracing?Apollo plugin??
cachingNo or HTTP cache controlApollo pluginHTTP cache controlNative support not yet. but still yes w/ HTTP cache control
ProblemLack of community support and toolchainBarrister IDL42.51 kb client-side bundle sizeUnstructured with multiple endpoints. awful portability.Grpc-web dev in progress140kb JS bundle. Compatibility issues: not all places support HTTP2 and grpc dependencies

Mark Sellers: technology is not an investor's economic moat

· One min read

==Economic moat==: a business' ability to maintain competitive advantages over its competitors in order to protect its long-term profits and market share

Those who are NOT sources of an economic moat

  • technology. technology will always be duplicated
  • reading a lot. ==reading only makes people keep up.== Everyone reads a lot in this business. Some read more than others, but it does not necessarily make you more competitive.
  • an MBA from a top school or any other degrees or designations. This often gives people a big paycheck even though it is the antithesis of what a great investor does.
  • Experience. In order to play the game, some level of experience is necessary, but at some point, it doesn’t help anymore.

Those who are sources of an economic moat

  1. economies of scale and scope. e.g. Wal-Mart, Home Depot, Lowe’s.
  2. network effect. e.g. eBay, Mastercard.
  3. intellectual property rights, e.g. patents, trademarks.
  4. high customer switching costs. Paychex and Microsoft.

Jerry Neumann: A taxonomy of moats.

Jerry Neumann: A taxonomy of moats

Past Work Experience Interview

· 3 min read

Target Audience

Individuals with some or little experience, or those who have not held any leadership or design positions in their careers (whether formal or informal).

Problem Description

Describe a project experience from your past that you found particularly interesting or memorable. Follow-up questions include:

  • Why did you find it interesting?
  • What was the most challenging part of the project, and how did you address those challenges?
  • What did you learn from this project? What would you have liked to know before starting the project?
  • Did you consider other design or implementation methods? Why did you choose the approach you took? If you were to choose again for the same project, what would you do differently?

Interviewer Tips

Since the goal here is to assess a person's technical communication skills and level of interest, and they may have participated in boot camps, you should be prepared to ask them more questions (whether for more details or about other aspects of the project). If they are recent graduates who have just completed their thesis, the thesis is often a good starting point. While this question is similar in many ways to resume questions in phone interviews, the content is about four times that of a phone interview and should be proportionately more detailed in asking what they did. Therefore, while the scoring criteria are similar, they should be evaluated with higher expectations and more data.

Scoring

Excellent candidates can:

  • Discuss project experiences thoroughly, with interactions in the interview being a dialogue rather than a directive.
  • Have a good understanding of the entire project, not just their area of focus, and be able to clearly articulate the design and intent of the project.
  • Show passion for any project and clearly describe the project elements that sparked that passion.
  • Clearly explain what alternatives were considered and why they chose the implementation strategy they took.
  • Reflect on their experiences and learn from them.

Good candidates may:

  • Encounter some questions in the interview but can resolve them with the interviewer's help.
  • Lack a broader understanding of the project but still have a strong grasp of the parts they interacted with directly and specific areas.
  • Appear passionate but may struggle to accurately explain where that passion comes from.
  • Discuss alternatives they considered but may not have thought deeply about them.
  • Reflect on their past experiences and draw lessons from them.

Poor candidates exhibit:

  • Struggle during the interview, making the interviewer feel like the candidate is interrogating them rather than having a conversation.
  • Lack detailed knowledge of the project even in their field of work. They may not understand why their product was designed that way or how it interacts with other systems.
  • When asked about the most interesting projects they have worked on, they should show interest in the product, but in fact, they may appear disinterested.
  • Be unfamiliar with potential alternative implementation methods.
  • Seem not to have reflected on or learned from their past project experiences. A key indicator of this situation is that answers to "What did you learn?" and "What would you do differently?" are very brief or nearly identical.

What can we communicate in soft skills interview?

· 2 min read

What is an interview?

An interview is a process for workers to find future co-workers, during which they are finding signals to answer the following three key questions:

  1. capability question - can you do the job?
  2. willingness question - will you do the job?
  3. culture-fit question - will you fit in?

Why is soft skill so important?

None of the critical questions above can be answered without good communication. Your job will be taken away by people who can talk better than you.

Generic answers (stories) to prepare

  1. hard-won triumph. How do you deal with failure? Briefly talk about the harshest moment, and then focus on how you battled back, and then salute the people who helped you. It demonstrates that you have the grit, team-building skills, and relevance to the job.
  2. influence. Can you guide people to yes? leaders = visionaries who inspire self-sacrifice. A leader does not exist without the ability to persuade.
  3. technical skills. Do you have a story proving your great technical skills?
  4. culture-fit. The FBI used to ask prospective agents what books they read until an underground network of tipsters figured out the ideal answer: “Tom Clancy spy novels.”
  5. fascination. What's fascinating about you? What makes you different from other people?

What is Apache Kafka?

· 3 min read

Apache Kafka is a distributed streaming platform.

Why use Apache Kafka?

Its abstraction is a ==queue== and it features

  • a distributed pub-sub messaging system that resolves N^2 relationships to N. Publishers and subscribers can operate at their own rates.
  • super fast with zero-copy technology
  • support fault-tolerant data persistence

It can be applied to

  • logging by topics
  • messaging system
  • geo-replication
  • stream processing

Why is Kafka so fast?

Kafka is using zero copy in which that CPU does not perform the task of copying data from one memory area to another.

Without zero copy:

With zero copy:

Architecture

Looking from outside, producers write to brokers, and consumers read from brokers.

Data is stored in topics and split into partitions which are replicated.

Kafka Cluster Overview

  1. Producer publishes messages to a specific topic.
    • Write to in-memory buffer first and flush to disk.
    • append-only sequence write for fast write.
    • Available to read after write to disks.
  2. Consumer pulls messages from a specific topic.
    • use an "offset pointer" (offset as seqId) to track/control its only read progress.
  3. A topic consists of partitions, load balance, partition (= ordered + immutable seq of msg that is continually appended to)
    • Partitions determine max consumer (group) parallelism. One consumer can read from only one partition at the same time.

How to serialize data? Avro

What is its network protocol? TCP

What is a partition's storage layout? O(1) disk read

How to tolerate fault?

==In-sync replica (ISR) protocol==. It tolerates (numReplicas - 1) dead brokers. Every partition has one leader and one or more followers.

Total Replicas = ISRs + out-of-sync replicas

  1. ISR is the set of replicas that are alive and have fully caught up with the leader (note that the leader is always in ISR).
  2. When a new message is published, the leader waits until it reaches all replicas in the ISR before committing the message.
  3. ==If a follower replica fails, it will be dropped out of the ISR and the leader then continues to commit new messages with fewer replicas in the ISR. Notice that now, the system is running in an under replicated mode.== If a leader fails, an ISR is picked to be a new leader.
  4. Out-of-sync replica keeps pulling message from the leader. Once catches up with the leader, it will be added back to the ISR.

Is Kafka an AP or CP system in CAP theorem?

Jun Rao says it is CA, because "Our goal was to support replication in a Kafka cluster within a single datacenter, where network partitioning is rare, so our design focuses on maintaining highly available and strongly consistent replicas."

However, it actually depends on the configuration.

  1. Out of the box with default config (min.insync.replicas=1, default.replication.factor=1) you are getting AP system (at-most-once).

  2. If you want to achieve CP, you may set min.insync.replicas=2 and topic replication factor of 3 - then producing a message with acks=all will guarantee CP setup (at-least-once), but (as expected) will block in cases when not enough replicas (<2) are available for particular topic/partition pair.

What is Apache Kafka?

· 3 min read

Apache Kafka is a distributed streaming platform.

Why use Apache Kafka?

Its abstraction is a ==queue==, and its features include:

  • A distributed publish-subscribe (pub-sub) messaging system that simplifies N ^ 2 relationships into N. Publishers and subscribers can operate at their own rates.
  • Ultra-fast zero-copy technology.
  • Support for fault-tolerant data persistence.

It can be applied to:

  • Logging by topic.
  • Messaging systems.
  • Off-site backups.
  • Stream processing.

Why is Kafka so fast?

Kafka uses zero-copy technology, where the CPU does not perform the task of copying data across storage area replicas.

Without zero-copy technology:

With zero-copy technology:

Architecture

From the outside, producers write to the Kafka cluster, while users read from the Kafka cluster.

Data is stored by topic and divided into partitions of replicable replicas.

Kafka Cluster Overview

  1. Producers publish messages to specific topics.
    • First, they are written to an in-memory buffer and then updated to disk.
    • To achieve fast writes, an append-only sequential write is used.
    • Messages can be read only after being written.
  2. Consumers fetch messages from specific topics.
    • They use an "offset pointer" (offset is the SEQ ID) to track/control their unique reading progress.
  3. A topic includes partitions and load balancing, where each partition is an ordered, immutable sequence of records.
    • Partitions determine the parallelism of users (groups). At any given time, a user can read from only one partition.

How to serialize data? Avro

What is its network protocol? TCP

What is the storage layout within a partition? O(1) disk reads.

How does fault tolerance work?

==In-Sync Replicas (ISR) protocol==. It allows (numReplicas - 1) nodes to fail. Each partition has one leader and one or more followers.

Total replicas = In-sync replicas + Out-of-sync replicas

  1. ISR is a set of live replicas that are in sync with the leader (note that the leader is always in the ISR).
  2. When publishing new messages, the leader waits to commit the message until it has been received by all replicas in the ISR.
  3. ==If a follower fails to stay in sync, it will exit the ISR, and then the leader will continue to commit new messages with fewer replicas in the ISR. Note that at this point, the system is operating in a low-replica state.== If a leader fails, another ISR will be elected as a new leader.
  4. Out-of-sync replicas continuously pull messages from the leader. Once they catch up to the leader, they will be added back to the ISR.

Is Kafka an AP or CP system in the CAP theorem?

Jun Rao believes it is CA because "our goal is to support replication within a Kafka cluster in a single data center, where network partitions are rare, so our design focuses on maintaining high availability and strong consistency of replicas."

However, it actually depends on the configuration.

  1. If using the initial configuration (min.insync.replicas=1, default.replication.factor=1), you will have an AP system (at most once).
  2. If you want to achieve CP, you can set min.insync.replicas=2, topic replication factor to 3, and then generate acks=all messages to guarantee CP settings (at least once). However, if there are not enough replicas (replica count < 2) for a specific topic/partition, writing will not succeed.

US Navy Pre-Flight School: How to fall asleep in 120 seconds?

· One min read

Why fall sleep fast?

In the battle ground, if you don’t sleep, you’ll burn out pretty quickly. You’ll make bad decisions. You’ll let people down and become a liability.

How to fall asleep in 120 seconds?

Principle: Relax the whole body one part by another and don’t think.

  1. Stretch out
  2. ==Relax face muscles and slow down everything==
  3. Relax upper body
    1. Let shoulders drop as low as they can
    2. Breathe in deeply. Then exhale slowly, blowing out all of the tension
    3. Relax arms. If it’s not relaxing, tense it first, then let it go loose
    4. Relax fore arm
    5. Relax hand
  4. Relax legs
  5. Not think about anything
    1. keep your mind still. You can do this by holding a static image in your head
    2. If that doesn’t work, say the words “don’t think… don’t think… don’t think” over and over for at least 10 second

U.S. Navy Method: How to Fall Asleep in 120 Seconds?

· One min read

Why Fall Asleep Quickly?

On the battlefield, if you don't sleep, you will quickly feel exhausted, make wrong decisions, feel burdened by your mission, and become a liability.

How to Do It?

Principle: Gradually relax your entire body, avoiding thoughts.

  1. Stretch your body
  2. Relax your facial muscles, slow everything down
  3. Relax your upper body
    1. Lower your shoulders as much as possible
    2. Take a deep breath, then exhale slowly, releasing all tension
    3. Relax your arms. If they are not relaxed enough, tense them first, then let them relax
    4. Relax your forearms
    5. Relax your hands
  4. Relax your legs
  5. Think of nothing at all
    1. Keep your mind calm. You can do this by holding a still image in your mind
    2. If that doesn't work, keep saying "don't think... don't think... don't think" for at least 10 seconds