Skip to main content

Web Technology troubleshooting

Get a troubleshooting question in the interview, and you are excited because some troubleshooting techniques came to your mind immediately?

Hold on!

Diving into a specific solution without clarifying the issue is usually a bad practice.
You should always ask questions to clarify the issue and start from the big picture.
Using "binary search"(yes or no question) to clarify the issue is a common practice.

"Users report they got error when visiting your website"

The big picture is this kind of troubleshooting question can usually be broken down into 3 parts.

  • client side issue
  • network issue
  • server side issue
After getting the big picture, you can start troubleshooting.

client side issues

  • Can you reproduce it?
    • Yes - it's obvious there is a bug. Find out what the bug is and file it. If you can not precisely find the root cause, at least summarize how to reproduce it, so the engineers who are in charge of this can better address the issue.
      • Caused by cache?
      • Caused by wrong parameters?
    • No - Ask the user to 
      1. try again in incognito mode
      2. use another browser
      3. clear browser cache
      • If one of the above approaches works, then users get a temporary workaround. However, it's likely there are bugs in our client side code. We better figure out what the bugs are.
        • It's likely the bugs are related to cache logic
      • If it's possible, ask users to record Charles Proxy log to see if the request is correct
        • Were parameters set correctly?
          • No - why? are there bugs in our client side code(e.g. js code)?

network issue

  • Use traceroute to see where the problem happened.
    • if the problem is in your network or user's network
      • Is ARP working as expected?
      • Is configuration all correct? (wrong switch setup?)
    • if the problem is outside of your or user's network
      • Call ISP for help

server side issue

  • Server program bugs
    • Read logs to see what happened.
  • Resources:
    • use top command to see CPU usage
    • use vmstat to see memory usage
    • use df to see disk usage
  • Dependency:
    • if database is working as expected
    • if CDN is working as expected

Comments

Popular posts from this blog

Common ideas to solve problems

Although problems may look very different from others, they usually share some common ideas. Array it's usually helpful to divide an array problem to subproblmes. Such as merge sort. Linked List runner: use 2 pointers - a fast runner and a slow runner to iterate over the list. recursion Recursion when you need to return multiple data from recursion, it's helpful to create a class to wrap the data

Steps to solve a coding problem

Diving in the problem directly is usually not a good idea. A good approach should should be: ask some questions to clarify the question think of some base test cases and edge cases. write the code test the code with cases analyze the complexity of your code can you can improve the complexity?

How DNS work

When entering www.google.com in the browser, the following process starts: Browser looks up it's cache to see if it knows the IP address(to see the DNS Cache in Chrome, go to chrome://net-internals/#dns) Computer checks local host file(usually /etc/hosts) Computer asks local DNS server(ISP DNS server) -> it's called recursive query Local DNS server checks local cache. If the IP address of this domain is not in the cache, the local DNS server starts the following iterative query procedure: local DNS server queries a global root server(there are 13 sets of root servers globally) A root server directs the local DNS server(resolver) to the IP of a top level domain(TLD) server The TLD server refers the resolver to the Google DNS server the Google DNS server knows the IP address of www.google.com  Local DNS server caches the IP address in case it needs the address in the future and returns it to the computer Computer caches the IP address and visits the address