查看: 2035| 回复: 1
跳转到指定楼层
上一主题 下一主题
收起左侧

[找工就业] 如何做trouble shooting

全局:

2022(1-3月)-CS硕士+3-5年 | 猎头|BayArea湾区 码农类General全职@databricks
这次面的公司中还是有一些公司需要现场debug或者trouble shooting,比如给你一个code base,里面有bug,从unittest的stack trace中查出问题,或者给一个情景,里面遇到一些异常的情况,问你哪些地方可能出问题。.google  и

Troubleshooting & Debugging Production Applications in Kubernetes

https://www.youtube.com/watch?v=t8eXXrUZ54Y

First go to staging env
Check Env; check right version, stack trace, visibility, logs
If you can not measure, you can not improve it. Quantify

- Tag with docker image, compare with prod and staging, kubectil describe pod xxx.1point3acres
    - Kubectl get pods -n staging ; frog artifactory
    - Make sure the right version
- Show logs: kubectl logs -f xxxx # if more than 1 instance
    - Kubetail helloworld-ui, ELK, centralized logs , console Cloud/splunk
- Is that happened in one machine or all of machine, bigQuery
    - Select count(*) occurrence, pod_id where payload like “exception”
    - Isolate the problem instance, mark it as offline
        - Kubectl port-forward hello… 8081:8080
- Distributed tracing
    - Zipkin, cloud 500x
- Debugging: stackDriver Debugger. Χ
    - Attach an agent, no need restart, name is empty

how to deal with prod issue?


- Rolling back
- First step is to identify the log for your application, ssh if load balance, collect logs on all instances
- From logs, can find the exception stack trace to 500 which code cause that Root cause analysis
- Debug the code in the local/stage even with the same data setup as prod and debug issue, Once code fix is done, can test in local or QA and stage env and promote a production on urgency and approval
- For any prod issue, has business impact, provide RCA and action
- Any code change, submit the change req contain  the business impact, deployment, roll back plan, notice downtime window for biz stakeholders

Debugging tips:
. Χ1. Come up with a hypothesis and test it, wrong url link?. 1point3acres.com
2. Reproduce the bug locally (staging)
3. Understand the code, library
4. Use print statement.
5. Use debugger effectively.google  и

performance issue

Utilization, saturation, errors :CPU, disk, network
Efficiency, latency, workload
- Load balance?
- Check all instance of JVM are up and running
- Any network latency for the intranet
- Is there any recent deployment
- Monitor CPU and memory utilization fine?. 1point 3acres
- Identify any dead locks and memory leaks in app using monitor tools Jconsole
- Which part of func experience the latency
- Measure the latency from logs or from browser dev tools
- If logs maintain properly identify which code cause the latency
- If latency issue due to SQL query, trouble shoot using Explain Plan for the queues and need to optimize query execution
- If latency issue due to application code, rewrite the logic and optimize
..
Stats that matter-baidu 1point3acres
API latency
Server Stats
Function latency





Step 1: Classify the Issue(0-10 seconds)
Check and classify the issue of what type it is. The issue usually belongs to one of the below categories.
1) DOS - People might complain that there is connection time out issue
2) Slow response - Almost all/ certain type of requests are slow, which might lead to the first case
3) improper behavior - The product is not working properly
4) Login issues - Session based issues.
5) High error rate - These are the silent issue that only developers know about.
Step 2: Check your monitoring tool(1 - 5 mins)
Almost all organisation will be having some tool for monitoring the servers. If you are a new startup/product who didn't use any tool, It is the right time to check it out.
Check the stats in the order below
Average Transaction time
DOS and slow request. Check if all request is a slow one or a particular type.
If all requests are slow, then it is a problem with either current app server/ Dependency services like MySQL, Redis, Kafka etc. So check the below for respective machine. 1point 3 acres
Machine status
Including checks for CPU(> 80%), Free memory(<10%), Active threads/ process(>90% of allocated), request wait time before processing(< 2s), GC Time(If you use GC based language > 10s),Free Disk size(< 5% ), heap memory(< few MBs).
1. If any of the above occurs, Take the necessary steps below.
2. High CPU - wait for some time/ check threads/process which takes a long time. It will always be code issue or increase machine size. 1point3acres.com
3. Free memory - Always code issue. Check the last deployment or increase machine size
4. Active threads - Too many active threads is because of too many requests got affected because of downstream / code issue. Check accordingly 5.GC Time - Your code is the problem. Check logs to see where GC occurs. Get a thread dump and check it out. 6.Free Disk size - Your code wrote something in the machine and it is not cleaned up. Check your app server for folder wise disk usage.. 1point 3acres
5. Head memory - Your code used many objects and didn't clear it out.
6. Dependency services - Check the above for all the services that your app depend upon like MYSQL, Redis, etc
Most of the above cases can be fixed by reverting your code.
Logs(5 - 10 mins)
If the above turns out empty handed, monitor your logs for recent errors. It will give you an overview or idea of what is happening. If you are using some log tool use dashboard for error module wise or region wise.
All the above check should reveal all the necessary things needed to fix. If not check with experts in your team immediately.
Step 3 - Check affected areas(1 - 10 mins)
Check what are the areas that were affected by the issue. If it is customer facing then immediately inform affected customers or severely affected customer. There are chances that downstream services might be affected. Check the below list and tick the areas where it was affected
1. DB/Cache/Downstream services data corruption
2. Data not sent to downstream
3. Replication Lag
Step 4: Fix the issue & deployment (3 - 30 mins)
If it is severe fix the issue by making the quick patch and update it all server. It should be solid and might require approval.
If it not server try to run all the test coverage and fix the main issue.
For downstream related problems write a script to correct the data. If data is completely corrupted use backup for recovery but customer concern is required.
Step 5: RCA and test case
Put down a neat RCA and inform the team. write down test cases for all those scenarios.
This is what I follow which enables me to fix the issue in production between 10 - 20 mins.. Waral dи,

Find the scope
First, take a look at the bug report and try to make some guess about the issue. Is it because of the code or could be something related to the server? Could it be related to the data on the live system?-baidu 1point3acres
Try to find the lines of code that are affecting these requests and also wrote down the path that requests go through step by step.
Make Sure. From 1point 3acres bbs
The next step is to make sure that the issue is happening only on the live system. There was a couple of times I got a report for a live issue but it was also happening on staging servers. In these scenarios, you could easily debug the staging server and do not take any risks on the live system.
Check the diff
I always check the latest release or find the release which causes the issue. Review the whole code and take notes for suspicious lines of codes. Sometimes you could find a rookie mistake that nobody paid attention to.
Staging vs. Production.
Make sure about the difference between staging and production setup. In production, you might have scaled your project, have different configurations, multiple databases, different caching strategies, etc. Take a note of the differences to have a better overview.
The life cycle
There is always a request or couple of requests which create the bug, wrote them down, check the life cycle for each of them. Make sure the requests are going through the way that you think. It could waste your time because the request is going through some other lines of code.
For instance, we had a release on the live system and some requests were failing because of naming. The developer added a function with the same name and there was a conflict. We changed the function name and everything goes back to normal.. 1point3acres.com
Minimize the scope-baidu 1point3acres
Test and debug everything one by one to minimize the scope for yourself. If you change multiple things together, it’s harder to find out which one was the issue.
Caching
Sometimes the caching configurations on the live system create the issue. Make sure the required caches have been updated.
Load Balancing
In a large-scale project in which you load balance the requests between multiple servers, you might have a broken node. Make sure all the nodes are updated and getting the request properly.
Everything is possible.1point3acres
The problem is not always the hardest one and anything is possible. Just remember to create different test cases to cover every possibility. Go through your test cases one by one and try to create the smallest scope for it.
Meaningful log messages
When you are adding logs to debug, remember to have a clear message in your logs. It’s easier to find them and also you don’t need to check the code again to see where was that log.


1. Stop Using Various Latest Technologies
It may be tempting to use the latest technologies for the best results. But remember, too much of anything is good for nothing, and it even applies to technologies..--
Hence, be attentive to keep them to a minimum so that it will be easier to manage later on in production.. 1point3acres.com
Don’t overindulge frameworks, technology, or a completely new language to the tech stack just for the sake that may have emerged.
All these have their own impact and may become incompatible later on. So, stop using various technologies at all costs and keep it simple.
2. Have Precise Logging Details-baidu 1point3acres
One of the essential tips that every developer should follow to speed up bug fixes in production is to have a precise and exact logging document that contains various information on how to resolve the production issue when it occurs. This helps you to find and fix errors in a faster way at the last minute.
But remember, when you prepare these kinds of documents, avoid filling them with unnecessary details which may mostly lead to confusion for the developers who are new to the project.
3. Have a Well-versed Production Debugging Team ..
It is crucial to consider the fact that these errors are usually reported by the end-user in your application when they experience them.
However, end-users never provide enough context on what caused that particular problem, but you have to understand and translate it into technical terms to find the exact fault as a well-versed developer.
In such a case, if you assign a maintenance team that is responsible for fixing the bugs and errors within the application that is not even well-versed with the application and lacks the knowledge to ask the right questions to the customer, it really becomes hard to find and fix the issue quicker.
Hence, to make your production debugging process faster and easier, it is also important to have a well-versed team to replicate customer issues, respond to queries and resolve at a faster pace.
Also Read: Beating Post-Launch Blues
4. Document All External Dependencies
It is essential to ensure that each external dependency is documented clearly within the ‘README’ file which will be found within the source system.
Having this documentation will help anyone in the future who deals with this application wants to understand what resources are required to run the application in a smooth manner.
If there’s any resource that’s optional or unavailable, then suggest alternatives or solutions on the way to handle things.
5. Eliminate Possible Causes. 1point3acres.com
In order to find out exactly what the problem was, it is important to start eliminating possible problematic code.
You can comment on a code block when working in a development environment or when running a test. However, when it comes to production, you have to get a little more creative and be clear about what you’re trying to solve.
Use data to pinpoint the problem, identify the impact, and prioritize the issue. But don’t stop there – help your team understand the problem from start to finish.. ----
6. Ensure All Software Components are Installed and Running. Χ
Before you try and fix any errors, make sure that all the software components which are responsible for the functioning of the application are installed and running.
Ensure that all changes in the code are updated to utilize the latest versions of software components. Software components may include things like database drivers, web servers, messaging servers, etc.
7. Make Good Use of Breakpoints.--
It is essential to place the breakpoints at the right place in the application to fasten your bug fixes in production. For instance, when debugging an issue on the Customer screen, there should be some Customer object where you can place breakpoints.
Thus, you can easily spot the breakpoints to determine whether the code is working or not.
8. Don’t Be Afraid to Ask for Help
One of the most important tips to speed up bug fixes in a production environment is to never be afraid to ask for help from your community or your co-workers.
There are times when you are worried about what others will think of you if you ask for help, which prevents you from asking for help. As a result, it will take you too long to fix bugs once encountered.
But when you ask for help from others, you may find a solution or learn something you didn’t know. Remember, it’s always a team effort to fix those bugs!
9. Run the Test Suite on all Target Platforms
This is a basic requirement for a valid bug fix. Developers should run their tests on different platforms before submitting their changes.
If some of the tests fail, then it means that there is either a problem with the code or dependencies that are being introduced with your code. Moreover, it is important to check how your application behaves on different devices, as there may be a problem specific to a certain model, architecture, or OS.
10. Always Stress Test Your Code in Production
Stress testing is nothing but you need to check what will happen in the worst scenario. While running an application do you make sure that it is not overloaded? Do you check if your application can handle all the traffic?
Do you make sure that if by any chance – such as a data center outage, or infrastructure issues – your application will keep working? Even if there is only a very slim chance it might still happen.
You should understand that the production environment is always different from testing and development environments.. Χ
11. Have a Production Debugging Tool-baidu 1point3acres

本帖子中包含更多资源

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x

评分

参与人数 2大米 +2 收起 理由
夏天天 + 1 很有用的信息!
hjj123567 + 1 给你点个赞!

查看全部评分


上一篇:Amazon Support Engineer
下一篇:Google L4 team match 求捞,已过HC
🔗
eax65536 2022-7-29 13:23:17 | 只看该作者
全局:
databricks VO? what level?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表