├── img └── interview │ ├── pingcap.jpg │ ├── bytedance.jpeg │ └── antfinacial.jpeg ├── docs └── antfin_k8s_jd.md ├── LICENSE └── README.md /img/interview/pingcap.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/awesome-interview/interview-3/master/img/interview/pingcap.jpg -------------------------------------------------------------------------------- /img/interview/bytedance.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/awesome-interview/interview-3/master/img/interview/bytedance.jpeg -------------------------------------------------------------------------------- /img/interview/antfinacial.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/awesome-interview/interview-3/master/img/interview/antfinacial.jpeg -------------------------------------------------------------------------------- /docs/antfin_k8s_jd.md: -------------------------------------------------------------------------------- 1 | # 社招JD 2 | 3 | ## 职位名称 4 | 5 | 蚂蚁金服容器资源调度专家 6 | 7 | ## 岗位描述 8 | 9 | 蚂蚁 Sigma 平台为蚂蚁金服上层业务提供标准容器服务和全局资源动态分配,调度节点单集群规模超过万台,同时致力于在系统、业务多个层面,包括 os/kernel、容器/PaaS、智能调度/仿真容量等进行技术突破,提高容器系统规模化的资源利用效率,降低大促等各种大规模复杂业务场景下的资源成本,打造智能、高效、稳定的金融级基础系统,助力蚂蚁科技金融。 10 | 11 | ## 职位职责 12 | 13 | 负责蚂蚁金服容器调度体系设计和研发 14 | 15 | 1. 设计和实现大规模、高效、智能的基于 Kubernetes 平台的新一代调度体系 16 | 2. 提高资源利用效率,降低成本,设计和研发混部、VPA、cpushare 等技术 17 | 3. 建设智能调度,结合动态运行数据、深度学习、强化学习等技术打造下一代智能化、可视化的调度技术 18 | 4. 支持计算类、大数据类、机器学习/深度学习等业务的资源调度,设计和研发高并发、低延迟、大规模的调度技术 19 | 20 | ## 能力要求 21 | 22 | 1. 熟练掌握 Golang 语言开发,具备 Python、Java 等其他一种或多种语言开发经验 23 | 2. 熟悉 Kubernetes/Docker 生态,熟练掌握 Kubernetes/容器调度相关技术和相关项目代码实现 24 | 3. 对 Linux 系统有深入的理解,特别对 cgroup、cpu share、memory share 等资源相关技术有相关经验者优先 25 | 4. 具备一定的生产运维经验,熟悉 DevOps 研发流程 26 | 5. 具备较强的团队沟通协作能力、自驱力和技术热情,具备实际的项目落地经验 27 | 28 | ## 额外加分 29 | 30 | 1. 有大规模集群资源利用率提升经验者额外加分 31 | 2. 有贡献 Kubernetes/Docker 相关开源项目者额外加分 32 | 3. 有其他 YARN、Mesos 和 Swarm 等平台调度技术研发经验者额外加分 33 | 4. 有搜索算法和数据分析经验者会有额外加分 34 | 5. 有 AI & MachineLearning on Kubernetes 经验者额外加分 35 | 36 | # 校招JD 37 | 38 | ## 职位名称 39 | 40 | 蚂蚁金服 - 资源调度研发工程师 & 实习研发工程师 41 | 42 | ## 岗位技术挑战 43 | 44 | 大规模云集群的高效调度和资源利用 45 | 46 | ## 职位描述 47 | 48 | 负责蚂蚁金服大规模云集群调度和资源体系设计和研发 49 | 50 | 1. 设计和实现大规模、高效、智能的基于 Kubernetes 平台的新一代调度体系 51 | 2. 提高资源利用效率、降低成本,设计和研发混部、VPA、cpushare 等技术 52 | 3. 建设智能调度,结合动态运行数据、深度学习、强化学习等技术打造下一代智能化、可视化的调度技术 53 | 4. 支持计算类、大数据类、机器学习/深度学习等业务的资源调度,设计和研发高并发、低延迟、大规模的调度技术 54 | 55 | ## 职位要求 56 | 57 | 1. 熟练掌握至少一种以上面向对象设计语言,如golang、java、python 58 | 2. 了解 Kubernetes/Docker 生态、具有一定的云计算概念基础 59 | 3. 对linux操作系统有一定的使用经验 60 | 4. 乐观开朗、积极向上 61 | 62 | ## 额外加分 63 | 64 | 1. 有Kubernetes使用经验者额外加分 65 | 2. 有云计算、云原生开源社区贡献经验者额外加分 66 | 3. 研究方向在云计算、调度和搜索算法、资源利用率提升者额外加分 67 | 4. 有云计算领域数据分析和机器学习相关经验者额外加分 68 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License 2 | 3 | By exercising the Licensed Rights (defined below), You accept and agree to be 4 | bound by the terms and conditions of this Creative Commons 5 | Attribution-NonCommercial-NoDerivatives 4.0 International Public License 6 | ("Public License"). To the extent this Public License may be interpreted as a 7 | contract, You are granted the Licensed Rights in consideration of Your 8 | acceptance of these terms and conditions, and the Licensor grants You such 9 | rights in consideration of benefits the Licensor receives from making the 10 | Licensed Material available under these terms and conditions. 11 | 12 | Section 1 – Definitions. 13 | 14 | a. Adapted Material means material subject to Copyright and Similar Rights 15 | that is derived from or based upon the Licensed Material and in which 16 | the Licensed Material is translated, altered, arranged, transformed, or 17 | otherwise modified in a manner requiring permission under the Copyright 18 | and Similar Rights held by the Licensor. For purposes of this Public 19 | License, where the Licensed Material is a musical work, performance, or 20 | sound recording, Adapted Material is always produced where the Licensed 21 | Material is synched in timed relation with a moving image. 22 | b. Copyright and Similar Rights means copyright and/or similar rights 23 | closely related to copyright including, without limitation, 24 | performance, broadcast, sound recording, and Sui Generis Database 25 | Rights, without regard to how the rights are labeled or categorized. 26 | For purposes of this Public License, the rights specified in Section 27 | 2(b)(1)-(2) are not Copyright and Similar Rights. 28 | c. Effective Technological Measures means those measures that, in the 29 | absence of proper authority, may not be circumvented under laws 30 | fulfilling obligations under Article 11 of the WIPO Copyright Treaty 31 | adopted on December 20, 1996, and/or similar international agreements. 32 | d. Exceptions and Limitations means fair use, fair dealing, and/or any 33 | other exception or limitation to Copyright and Similar Rights that 34 | applies to Your use of the Licensed Material. 35 | e. Licensed Material means the artistic or literary work, database, or 36 | other material to which the Licensor applied this Public License. 37 | f. Licensed Rights means the rights granted to You subject to the terms 38 | and conditions of this Public License, which are limited to all 39 | Copyright and Similar Rights that apply to Your use of the Licensed 40 | Material and that the Licensor has authority to license. 41 | g. Licensor means the individual(s) or entity(ies) granting rights under 42 | this Public License. 43 | h. NonCommercial means not primarily intended for or directed towards 44 | commercial advantage or monetary compensation. For purposes of this 45 | Public License, the exchange of the Licensed Material for other 46 | material subject to Copyright and Similar Rights by digital 47 | file-sharing or similar means is NonCommercial provided there is no 48 | payment of monetary compensation in connection with the exchange. 49 | i. Share means to provide material to the public by any means or process 50 | that requires permission under the Licensed Rights, such as 51 | reproduction, public display, public performance, distribution, 52 | dissemination, communication, or importation, and to make material 53 | available to the public including in ways that members of the public 54 | may access the material from a place and at a time individually chosen 55 | by them. 56 | j. Sui Generis Database Rights means rights other than copyright resulting 57 | from Directive 96/9/EC of the European Parliament and of the Council of 58 | 11 March 1996 on the legal protection of databases, as amended and/or 59 | succeeded, as well as other essentially equivalent rights anywhere in 60 | the world. 61 | k. You means the individual or entity exercising the Licensed Rights under 62 | this Public License. Your has a corresponding meaning. 63 | 64 | Section 2 – Scope. 65 | 66 | a. License grant. 67 | 1. Subject to the terms and conditions of this Public License, the 68 | Licensor hereby grants You a worldwide, royalty-free, 69 | non-sublicensable, non-exclusive, irrevocable license to exercise 70 | the Licensed Rights in the Licensed Material to: 71 | A. reproduce and Share the Licensed Material, in whole or in part, 72 | for NonCommercial purposes only; and 73 | B. produce and reproduce, but not Share, Adapted Material for 74 | NonCommercial purposes only. 75 | 2. Exceptions and Limitations. For the avoidance of doubt, where 76 | Exceptions and Limitations apply to Your use, this Public License 77 | does not apply, and You do not need to comply with its terms and 78 | conditions. 79 | 3. Term. The term of this Public License is specified in Section 6(a). 80 | 4. Media and formats; technical modifications allowed. The Licensor 81 | authorizes You to exercise the Licensed Rights in all media and 82 | formats whether now known or hereafter created, and to make 83 | technical modifications necessary to do so. The Licensor waives 84 | and/or agrees not to assert any right or authority to forbid You 85 | from making technical modifications necessary to exercise the 86 | Licensed Rights, including technical modifications necessary to 87 | circumvent Effective Technological Measures. For purposes of this 88 | Public License, simply making modifications authorized by this 89 | Section 2(a)(4) never produces Adapted Material. 90 | 5. Downstream recipients. 91 | A. Offer from the Licensor – Licensed Material. Every recipient of 92 | the Licensed Material automatically receives an offer from the 93 | Licensor to exercise the Licensed Rights under the terms and 94 | conditions of this Public License. 95 | B. No downstream restrictions. You may not offer or impose any 96 | additional or different terms or conditions on, or apply any 97 | Effective Technological Measures to, the Licensed Material if 98 | doing so restricts exercise of the Licensed Rights by any 99 | recipient of the Licensed Material. 100 | 6. No endorsement. Nothing in this Public License constitutes or may 101 | be construed as permission to assert or imply that You are, or that 102 | Your use of the Licensed Material is, connected with, or sponsored, 103 | endorsed, or granted official status by, the Licensor or others 104 | designated to receive attribution as provided in Section 105 | 3(a)(1)(A)(i). 106 | 107 | b. Other rights. 108 | 1. Moral rights, such as the right of integrity, are not licensed 109 | under this Public License, nor are publicity, privacy, and/or other 110 | similar personality rights; however, to the extent possible, the 111 | Licensor waives and/or agrees not to assert any such rights held by 112 | the Licensor to the limited extent necessary to allow You to 113 | exercise the Licensed Rights, but not otherwise. 114 | 2. Patent and trademark rights are not licensed under this Public 115 | License. 116 | 3. To the extent possible, the Licensor waives any right to collect 117 | royalties from You for the exercise of the Licensed Rights, whether 118 | directly or through a collecting society under any voluntary or 119 | waivable statutory or compulsory licensing scheme. In all other 120 | cases the Licensor expressly reserves any right to collect such 121 | royalties, including when the Licensed Material is used other than 122 | for NonCommercial purposes. 123 | 124 | Section 3 – License Conditions. 125 | 126 | Your exercise of the Licensed Rights is expressly made subject to the following conditions. 127 | 128 | a. Attribution. 129 | 130 | 1. If You Share the Licensed Material, You must: 131 | A. retain the following if it is supplied by the Licensor with the 132 | Licensed Material: 133 | i. identification of the creator(s) of the Licensed Material 134 | and any others designated to receive attribution, in any 135 | reasonable manner requested by the Licensor (including by 136 | pseudonym if designated); 137 | ii. a copyright notice; 138 | iii. a notice that refers to this Public License; 139 | iv. a notice that refers to the disclaimer of warranties; 140 | v. a URI or hyperlink to the Licensed Material to the extent 141 | reasonably practicable; 142 | B. indicate if You modified the Licensed Material and retain an 143 | indication of any previous modifications; and 144 | C. indicate the Licensed Material is licensed under this Public 145 | License, and include the text of, or the URI or hyperlink to, 146 | this Public License. 147 | 148 | For the avoidance of doubt, You do not have permission under this 149 | Public License to Share Adapted Material. 150 | 151 | 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable 152 | manner based on the medium, means, and context in which You Share 153 | the Licensed Material. For example, it may be reasonable to satisfy 154 | the conditions by providing a URI or hyperlink to a resource that 155 | includes the required information. 156 | 3. If requested by the Licensor, You must remove any of the 157 | information required by Section 3(a)(1)(A) to the extent reasonably 158 | practicable. 159 | 160 | Section 4 – Sui Generis Database Rights. 161 | 162 | Where the Licensed Rights include Sui Generis Database Rights that apply to 163 | Your use of the Licensed Material: 164 | 165 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right to 166 | extract, reuse, reproduce, and Share all or a substantial portion of 167 | the contents of the database for NonCommercial purposes only and 168 | provided You do not Share Adapted Material; 169 | b. if You include all or a substantial portion of the database contents in 170 | a database in which You have Sui Generis Database Rights, then the 171 | database in which You have Sui Generis Database Rights (but not its 172 | individual contents) is Adapted Material; and 173 | c. You must comply with the conditions in Section 3(a) if You Share all or 174 | a substantial portion of the contents of the database. 175 | 176 | For the avoidance of doubt, this Section 4 supplements and does not replace 177 | Your obligations under this Public License where the Licensed Rights include 178 | other Copyright and Similar Rights. 179 | 180 | Section 5 – Disclaimer of Warranties and Limitation of Liability. 181 | 182 | a. Unless otherwise separately undertaken by the Licensor, to the extent 183 | possible, the Licensor offers the Licensed Material as-is and 184 | as-available, and makes no representations or warranties of any kind 185 | concerning the Licensed Material, whether express, implied, statutory, 186 | or other. This includes, without limitation, warranties of title, 187 | merchantability, fitness for a particular purpose, non-infringement, 188 | absence of latent or other defects, accuracy, or the presence or 189 | absence of errors, whether or not known or discoverable. Where 190 | disclaimers of warranties are not allowed in full or in part, this 191 | disclaimer may not apply to You. 192 | b. To the extent possible, in no event will the Licensor be liable to You 193 | on any legal theory (including, without limitation, negligence) or 194 | otherwise for any direct, special, indirect, incidental, consequential, 195 | punitive, exemplary, or other losses, costs, expenses, or damages 196 | arising out of this Public License or use of the Licensed Material, 197 | even if the Licensor has been advised of the possibility of such 198 | losses, costs, expenses, or damages. Where a limitation of liability is 199 | not allowed in full or in part, this limitation may not apply to You. 200 | c. The disclaimer of warranties and limitation of liability provided above 201 | shall be interpreted in a manner that, to the extent possible, most 202 | closely approximates an absolute disclaimer and waiver of all 203 | liability. 204 | 205 | Section 6 – Term and Termination. 206 | 207 | a. This Public License applies for the term of the Copyright and Similar 208 | Rights licensed here. However, if You fail to comply with this Public 209 | License, then Your rights under this Public License terminate 210 | automatically. 211 | b. Where Your right to use the Licensed Material has terminated under 212 | Section 6(a), it reinstates: 213 | 1. automatically as of the date the violation is cured, provided it is 214 | cured within 30 days of Your discovery of the violation; or 215 | 2. upon express reinstatement by the Licensor. 216 | 217 | For the avoidance of doubt, this Section 6(b) does not affect any right 218 | the Licensor may have to seek remedies for Your violations of this 219 | Public License. 220 | 221 | c. For the avoidance of doubt, the Licensor may also offer the Licensed 222 | Material under separate terms or conditions or stop distributing the 223 | Licensed Material at any time; however, doing so will not terminate 224 | this Public License. 225 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. 226 | 227 | Section 7 – Other Terms and Conditions. 228 | 229 | a. The Licensor shall not be bound by any additional or different terms or 230 | conditions communicated by You unless expressly agreed. 231 | b. Any arrangements, understandings, or agreements regarding the Licensed 232 | Material not stated herein are separate from and independent of the 233 | terms and conditions of this Public License. 234 | 235 | Section 8 – Interpretation. 236 | 237 | a. For the avoidance of doubt, this Public License does not, and shall not 238 | be interpreted to, reduce, limit, restrict, or impose conditions on any 239 | use of the Licensed Material that could lawfully be made without 240 | permission under this Public License. 241 | b. To the extent possible, if any provision of this Public License is 242 | deemed unenforceable, it shall be automatically reformed to the minimum 243 | extent necessary to make it enforceable. If the provision cannot be 244 | reformed, it shall be severed from this Public License without 245 | affecting the enforceability of the remaining terms and conditions. 246 | c. No term or condition of this Public License will be waived and no 247 | failure to comply consented to unless expressly agreed to by the Licensor. 248 | d. Nothing in this Public License constitutes or may be interpreted as a 249 | limitation upon, or waiver of, any privileges and immunities that apply 250 | to the Licensor or You, including from the legal processes of any 251 | jurisdiction or authority. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 写在19年初的后端社招面试经历(两年经验): 蚂蚁 头条 PingCAP 2 | 3 | 去年(18年)年底想出来看看机会,最后很幸运地拿到了 PingCAP,今日头条的 offer 以及蚂蚁金服的口头 offer。想着可以总结一下经验,分享一下自己这一段"骑驴找马"过的心路历程。当然,一家之言,难免粗浅,如有不妥,敬请指正。 4 | 5 | 全文有点长,假如只对一家公司感兴趣的话可以直接跳过去: 6 | 7 | * [准备过程](#准备过程) 8 | * [面试: PingCAP](#pingcap) 9 | * [面试: 蚂蚁](#蚂蚁) 10 | * [面试: 头条](#头条) 11 | * [总结](#总结) 12 | 13 | # 准备过程 14 | 15 | 我自己是本科毕业后在老东家干了两年多,老东家算是一家"小公司"(毕竟这年头没有 BAT 或 TMD 的 title 都不好意思报出身),毕业这两年多我也没有在大厂待过,因此找坑的时候是非常非常虚的。迫于心慌,我好好思考了一阵来给自己打气,当时真正找坑和准备面试的过程大概分为这几个阶段: 16 | 17 | - 反思:自己是不是真的要离职,假如不离职,在老东家接下来应该做什么才能继续提升? 18 | - 定位:我在硬性技能(编码、架构)上的长处在哪?我在软技能(沟通,团队)上的长处在哪?这步顺带写了简历 19 | - 寻找平台:哪些平台能同时满足:1、有挑战有上升空间;2、符合我的定位方向;3、团队氛围和老东家一样好(或更好) 20 | - 找人内推:基本都是在 v2 上找的(诚挚感谢各位帮助我内推的大佬) 21 | - 面试谈 offer 22 | 23 | `定位`这一步其实花了好几天时间,我先是梳理了自己的项目经历和工作内容的专长,把 Java + Golang,做过的面比较广(业务,中间件,基础架构都做过)以及对 k8s 云原生有专长和兴趣作为自己的"硬招牌"。然后把学习能力强,喜欢沟通合作,渴望挑战作为我的"软招牌",最后把自己定位成一个"在过往经历中展现出了过人学习能力和钻研能力,同时渴望挑战,不愿意呆在舒适区"的形象(妈呀打这段话的时候太羞耻了!!!)。 24 | 25 | 这个过程中,我的方法论是"换位思考"。自己过去也面试过不少人(所以平时公司让我去面试,虽然累点苦点,但也都是积累呀),并且也和 HR 以及放出 HC 的业务方聊过我们希望放什么样的人进来。因此全程都在以面试官的心态来考察自己: 26 | 27 | 28 | > 假如我是面试官,我会招怎样的人进来做我的同事? 29 | 30 | 31 | 举几个例子,下面都是我在这个过程中考虑过的问题(当然只是我自己的喜好): 32 | 33 | * **对于一个毕业两年多的人,我最希望他有什么特质**?这个阶段的人其实还是"空杯",我希望他有很强的学习能力和进取心,给自己部门培养出一个超级生产力; 34 | * **什么样的行为会让我"讨厌一份简历"**:把每个项目都大写特写,尤其是陈述细节没有重点;罗列框架当能力,用过了一类场景的框架就觉得能解决一类业务诸如此类; 35 | * **面试的时候我会偏向于问哪些问题**?一是简历上写了"理解"或"精通"的语言与中间件;二是简历上写得比较有趣,又没有完全交代清楚的项目; 36 | 37 | `定位`之后,我要找的下一个位置基本锁定在了 PaaS、云原生、中间件方向。那接下来就是找坑了,这段时间"寒冬论"炒的火热,好坑确实挺难找,最后兜兜转转找了四家的内推:Shopee(新加坡)、PingCAP、头条、蚂蚁。Shopee 那边挺遗憾的,12月初投完简历后在1月初进行的第一轮 HR Screen,而当时另几家面试已经临近尾声,于是选择了推掉,后来确认是12月 Shopee 正好在休假,会说中文的 HR 都恰好不在,这也算是机缘巧合了😆Shopee 给我的感觉(虽然只有一面)是非常为员工考虑,HR 小姐姐很客观地帮我梳理了很多去新加坡会带来的利弊得失。大家假如对 Shopee 感兴趣,浩松老师 [@haosdent](https://github.com/haosdent) 本人就出现在了 issue 区,可以去找找看😆 38 | 39 | 这几家的简历投递出去之后,我着重把简历里"埋的几个坑",也就是自己写了"理解并掌握"的语言与中间件以及专门用来勾引面试官问的项目好好复习了一遍。事后发现这一步还挺关键的,很多知识性的内容要是不复习一下真就全忘了,这也算临阵磨枪,不快也光了吧。 40 | 41 | 接下来就进入正题,逐家讲一下自己的面试体验: 42 | 43 | - [PingCAP - Cloud 方向](#pingcap) 44 | - [蚂蚁 - 容器调度方向(CTO线)](#蚂蚁) 45 | - [头条 - 工程效能方向](#头条) 46 | 47 | # PingCAP 48 | 49 | ![pingcap](/img/interview/pingcap.jpg) 50 | 51 | * [面试前](#面试前) 52 | * [一面](#一面) 53 | * [二面](#二面) 54 | * [三面](#三面) 55 | * [四面](#四面) 56 | * [五面](#五面) 57 | * [PingCAP 小结](#pingcap-小结) 58 | 59 | ## 面试前 60 | 61 | PingCAP 的简历响应是最快的,内推之后第二天 HR 小姐姐就联系了我。电话接通之后先是简单聊了一下人生,然后就是社招三问 ["**为啥离职啊?**","**现在待遇咋样啊?**","**期望待遇咋样啊?**"],天知道这通电话是我开始投简历之后的第一通电话面试,之前还完全没有准备过类似的问题,只能稀里哗啦用["**现在自己的技术成长有点碰到瓶颈,加上一直对您公司钦慕有加☺️**","**我现在待遇是xxx但我司除了base之外还有xxx以及我马上要提薪了🤪**","**其实比起待遇我更看重平台和挑战(狗头),但是基本的薪资需求我还是希望能xxx🤑**"]这样和稀泥应付过去。内心稍稍平静之后小姐姐跟我讲了讲我意向部门的结构和主体业务,然后交代了一下接下来的面试流程,约了"一面"并且加了微信。 62 | 63 | "一面"加了引号,这是因为"一面"其实是在微信上布置了一个小项目,然后约定好时间验收。 64 | 65 | > 这里要特别感谢一下 PingCAP 的 HR 小姐姐,加了微信之后全程帮助我协调面试时间并不厌其烦地回答我各种奇奇怪怪的问题,最后谈 offer 的时候还给我准备了一个惊喜。面试体验直接满星<3! 66 | 67 | ## 一面 68 | 69 | 早就听说 PingCAP 一面要写小项目,我自己心里其实是跃跃欲试的。面试官给的项目要求大体是这样: 70 | 71 | > K8S 容器化之后应用容器里几乎没有什么可用的调试工具,可以利用容器 Namespace 共享的思路,启动一个包含各种调试工具(比如 netstat, gdb)的容器,加入到 pod 的 pid、net 等 namespace 中, 实现对任意 pod 的 debug 功能。现在希望利用 kubectl plugin 机制实现一个插件,用于 debug 任意一个 pod 里的容器,达到 `kubectl exec` 的使用体验. 72 | 73 | 当时因为工作日抽不出时间,就隔了几天到周五晚上开始写,周六晚上写完并且把 [项目地址](https://github.com/aylei/kubectl-debug) 分享到了 [Reddit 上](https://www.reddit.com/r/devops/comments/a8vnt5/i_wrote_a_tool_to_debug_kubernetes_pods_more/)。没想到运气不错收了 100 多个 star,这下我就觉得"哦豁,这轮应该稳了吧!"(结果后来发现这几乎是我唯一一把觉得自己"稳了的"面试...) 74 | 75 | ## 二面 76 | 77 | 二面是一位 Cloud 方向的前辈面我,全程大概微信语音聊了50多分钟: 78 | 79 | - 问项目经历,聊了两个项目 80 | - 对 Kubernetes 了解怎么样,看过源码吗? 81 | - k8s 的代码我以前其实只看过 kubelet,临阵磨枪的时候把 apiserver、scheduler、controller-manager 都看了一遍,笑容渐渐出现。 82 | - Kubernetes 的 Service 是什么概念,怎么实现的? 83 | - 你刚说到 Informer,Informer 是怎么实现的,有什么作用? 84 | - StatefulSet 用过吗?有什么特点? 85 | - StatefulSet 的滚动升级是如何实现的? 86 | - 现在我们希望只升级 StatefulSet 中的任意个节点进行测试, 可以怎么做? 87 | - 这题没有思路,只好强答用"两个 StatefulSet",后来一想起一个新的 StatefulSet 那 PV 里的数据就丢了,其实正确办法是利用 partition 机制,笑容渐渐消失。 88 | - Kubernetes 的所有资源约定了版本号, 为什么要这么做? 89 | - 第二个拿不准的问题,我面试前就反复告诉自己"**不要强答**"以及"**不知道的题就讲思路**",于是就说这块代码确实没看过,但是根据微服务 API 的设计理念,版本号的作用有巴拉巴拉。答完似乎面试官还算满意,于是又往下挖了一句: 90 | - 假如有多几个版本号并存, 那么 K8S 服务端需要维护几套代码? 91 | - 这题完全不知道,内心逐渐焦灼,立马走老套路"这我没看过 k8s 代码怎么写的无法确定(想表达自己真正看过代码才会确认,凸显自己严谨...我的妈呀),但假如由我来写这份代码(装作非常自信),我会只会维护一份最新的 Model,然后设计对应一个版本段的 Adpater 将老版本的 Model 转化过来巴拉巴拉"。到这里我已经虚的不行了 92 | - OK,那接下来我们聊聊 Golang (我:长舒一口气) 93 | - 看一下这段代码有没有问题(一段 golang for-range 里 goroutine 闭包捕获的代码),为什么? 94 | - goroutine 是怎么调度的? 95 | - goroutine 和 kernel thread 之间是什么关系? 96 | - 有什么想问我的? 97 | 98 | 面完之后感觉答得一般,心里有点忐忑。结果第二天 HR 小姐姐就来安排三面了,长舒了一口气。 99 | 100 | ## 三面 101 | 102 | 三面是和整个大部门的 Leader 聊,面试官很能聊(声音还很好听!)而且技术非常全面,全程大概微信语音聊了80多分钟: 103 | 104 | - 给我介绍 PingCAP 相关团队的职责与挑战 105 | - 聊为什么出来看机会,以及未来的职业规划 106 | - 聊我之前做的一个数据同步的项目,大概内容是订阅 MySQL Binlog,sink 到搜索索引、分库分表以及业务事件订阅流中 107 | - 为什么数据同步里选择了 xxxx 开源项目,优势在哪? 108 | - 订阅分库分表的 Binlog 怎么订阅? 109 | - 分库分表的数据源中假如存在主键冲突要怎么解决? 110 | - 怎么保证下游对 Binlog 的消费顺序? 111 | - 如何在下游保证消费时的事务原子性? 112 | - 描述了一下 tidb 的 binlog 架构,问这种场景下怎么保证 Binlog 顺序 113 | - 聊一个上了 Kubernetes 的项目,问了一些细节和坑 114 | - 用 Kubernetes 之后,解决了哪些问题? 115 | - 聊我之前做的监控警报项目,问背景和产出 116 | - Prometheus 单实例数据量级 hold 不住了,有什么解决方案? 117 | - 有什么想问我的? 118 | 119 | 简历里的"数据同步"这个项目我是好好复习过自己当年写的调研文档和架构文档的,也做了被问的准备(换位思考,是我我也问。这个其实就是我专门希望面试官来挖细节的项目)。最后确实被问最多的就是这个项目,运气真的不错😁。 120 | 121 | ## 四面 122 | 123 | 四面到了现场面,有两位面试官一起跟我聊,大约聊了 40 多分钟: 124 | 125 | - 聊"配置中心"项目的细节 126 | - 为什么不用 ZK,要自己再写一个"配置中心" 127 | - 这个问题让我措手不及,我只好坦白:当时年轻,想刷经验,事后才领悟到不要重复造轮子,当然最后系统的产出也不错(后面这两句是我临时加的,不能让面试官觉得我是一个不看全局只顾自己刷经验的人) 128 | - 配置中心怎么做服务发现的?怎么做 failover 的? 129 | - 用 Kubernetes 碰到过哪些坑? 130 | - 对 Prometheus 做了哪些改动? 131 | - 对 Alertmanager 做了哪些改动? 132 | - 监控系统怎么做"自监控"? 133 | - 跨机房的网络问题怎么监控? 134 | - 有什么想问我们的? 135 | 136 | 四面是纯项目,里面的经验就不太通用了。但这里面有个细节,就是到中途的时候两个面试官互相对了一下"还有什么想问的吗?"我意识到面试官们想问的问题不多了,可时间大约才过了20分钟(**面试时间过短是一个 bad smell**)。于是之后几个监控的问题我都尽量说得很细,同时顺便提一下"还有一个方面我们当时也做了挺多工作",暗示面试官往下挖的线索。不知道这招有没有奏效,反正这一面算是有惊无险过啦。 137 | 138 | ## 五面 139 | 140 | 技术面到四面就结束了,五面是创始人面(有幸和崔秋大佬聊了20多分钟人生),面完之后就是 offer call 了。 141 | 142 | ## PingCAP 小结 143 | 144 | 一些主观评价: 145 | 146 | * 面试难度:正常 147 | * 面试体验:我给满分 148 | * 问题偏向:项目经历、工程能力 149 | 150 | > 这里真的想夸一下 PingCAP(因为面试体验超棒呀!)。投 PingCAP 的初衷是觉得这个团队的工程师文化非常浓,大牛云集,同时 TiDB 够牛逼,项目开源的模式我内心也很认可。只是挂羊头卖狗肉的公司也不少,好多 JD 上写着工程师文化浓郁,其实很多根本不是那么回事儿。但是经过 PingCAP 的五轮面试之后,我实打实地感受到了工程师文化:面试里没有任何一个"刁难人的问题",每一位面试官感兴趣的是我的工程思维、学习能力、技术见解,同时还非常热衷于与我讨论和深挖一些坑与技术决策。这种感觉就很爽:**面试官是懂我的,我作为工程师的思维能力与技术见解得到了认可与尊重。** 这种氛围是口号喊不出来的,因为它的硬性指标就是这其中的每一个人要热爱技术并且工程经验丰富。 151 | 152 | # 蚂蚁 153 | 154 | ![ant](/img/interview/antfinacial.jpeg) 155 | 156 | * [面试前](#面试前-1) 157 | * [一面](#一面-1) 158 | * [二面](#二面-1) 159 | * [三面](#三面-1) 160 | * [四面](#四面-1) 161 | * [五面](#五面-1) 162 | * [六面(HR)](#六面) 163 | * [小结](#小结) 164 | 165 | ## 面试前 166 | 167 | 蚂蚁的面试挺独特,每轮面试都没有 HR 约时间,一般是晚上 8 点左右面试官来一个电话,问是否能面试,能的话开始面,不能就约一个其它时间。 168 | 169 | 全程 6 面,前五面技术面,电话面试,最后一面是 HR 面,现场面。 170 | 171 | ## 一面 172 | 173 | - 介绍一下自己 174 | - 问项目经历, 聊"数据同步" 175 | - 接着聊上了 K8S 的项目 176 | - 有没有什么钻研得比较深得技术?(我:kubernetes, golang, prometheus, java) 177 | - kubernetes 的架构是怎么样的? 178 | - 这个问题很大,拆成 apiserver、controller、kubelet、scheduler 讲了一下 179 | - golang 与 java 的比较 180 | - 这个问题又很大,当时主要对比了 vm、协程支持、面向对象和泛型的区别、以及自己对各自使用场景的一些理解 181 | - golang 的 gc 算法 182 | - 知道是三色标记,不过细节说不上来 183 | - 从无限的字符流中, 随机选出 10 个字符 184 | - 没见过也没想出来,查了一下是[蓄水池采样算法](https://www.jianshu.com/p/7a9ea6ece2af),经典面试题,没刷题吃亏了 185 | - 怎么扩展 kubernetes scheduler, 让它能 handle 大规模的节点调度 186 | - 单节点提速:优选阶段随机取部分节点进行优选;水平扩展 scheduler 节点,pod 做一致性 hash 来决定由哪个 scheduler 调度 187 | - 你有什么想问我的? 188 | 189 | 一面其实有点僵,我自己完全没放开,面试官对我的回答没有什么反馈和深入,都是"哦好的"然后就过了。所以我当时面完觉得自己其实已经挂了(我自己要是对候选人不感兴趣,有时候也就问完问题走个过场溜了),后来收到二面电话着实吃惊了一下。 190 | 191 | ## 二面 192 | 193 | - 先聊了聊项目 194 | - 给 Prometheus 做了哪些改动? 195 | - 自研配置中心, 具体做了哪些内容? 196 | - 有用过 MySQL 的什么高级特性吗? 197 | - 这里不太理解,我问什么算高级特性,面试官就切换到了下一个问题 198 | - 配置中心的核心数据表是怎么设计的? 199 | - 为什么在业务里用 Redis, Redis 有什么优点? 200 | - 单线程:并发安全;高性能;原语与数据结构丰富;采用广泛,踩坑成本低 201 | - 对 Redis 里数据结构的实现熟悉吗? 202 | - 说了一个 zset 跳表 203 | - 用过 Redis 的哪些数据结构, 分别用在什么场景? 204 | - Java 初始化一个线程池有哪些参数可以配置, 分别是什么作用? 205 | - 自己写的 Java 应用调优过哪些 JVM 参数, 为什么这么调优? 206 | - 这个问住了,我只知道最大堆最小堆,开 G1,开 GC 日志以及 OOM dumper 这些基本的 207 | - 用 Jetty 的时候有没有配什么参数, 为什么这么配? 208 | - Jetty QTP 等待队列配置成无限的话, 你觉得好吗? 会有什么问题吗? 209 | - 用过 Linux Bash 里的哪些命令, 分别用它们干嘛? 210 | - 一道笔试题: 需要在给的链接中作答, 不能 google, 不能跳出, 不能用 IDE: 211 | 212 | 题目是这样的: 213 | 214 | > 启动两个线程, 一个输出 1,3,5,7…99, 另一个输出 2,4,6,8…100 最后 STDOUT 中按序输出 1,2,3,4,5…100 215 | 216 | 我: 我用 Go 实现吧 217 | 218 | 面试官: 不可以,用 Java 的 notify 机制实现 219 | 220 | 我: (还没意识到问题的严峻) 那我用 Java BlockingQueue 221 | 222 | 面试官:说不可以, 要求用 Java 的 wait + notify 机制来实现 223 | 224 | 我完全没写过 wait + notify,只能表示不会(菜鸡本鸡了), 面试官说那行吧你可以用 go 写 225 | 226 | 最后用 go channel 实现了一版, 不过给的网页上不能运行代码,也不知道写得对不对,然后面试结束。 227 | 228 | 这一轮面试官延续了一面的风格,问完一题就赶忙下一题了,似乎没有表现出对我的回答有兴趣或认可。因此这轮面完,我又觉得自己挂了... 229 | 230 | ## 三面 231 | 232 | - 依然先聊项目 233 | - 对监控警报的项目很感兴趣, 问了挺多细节, 最后问了一个问题: 现在要你实现一个语义不弱于 PromQL 的查询语言, 你能实现吗? 234 | - 这里虽然看过一些 Prometheus 的代码,但其实对 PromQL 的 lexer 和 parser 部分没有细看,还好之前因为数据同步项目里想写声明式 Stream SQL 研究过一点 ANTLR,用 ANTLR 写语法 + AST 遍历塞查询逻辑给糊弄过去了。 235 | - 问我觉得做得最深入的项目是什么 236 | - 当然是数据同步(狗头) 237 | - 聊数据同步项目(这个很符合我的预期,哈哈哈哈) 238 | - 问 Linux 掌握得怎么样? 239 | - 没有系统学习过,基本上是自己运维踩坑积累的 240 | - 问 Golang 掌握得怎么样? 241 | - 用了半年, 看过 effective go 242 | - 问算法掌握得怎么样? 243 | - 到图为止都可以 244 | - 问最短路算法 245 | - 只记得 dijkstra 了,描述了代码流程 246 | - k8s 掌握得怎么样? 247 | - 不怎么样,没有自己写过 controller 和 scheduler,但是对概念都很熟悉,看过 xxx 这几部分的源码 248 | - k8s 的 exec 是怎么实现的? 249 | - 这个问题正中下怀,之前写了 PingCAP 的小作业正好对这块特别熟悉 250 | 251 | 这轮聊得顺畅多了。同时发现蚂蚁的面试官似乎挺喜欢让你自己评价自己的:"你觉得自己 xxx 掌握得怎么样?"(只有五位面试官,样本不够大,不能作数哦),这类问题其实我慌得要死,怕自己吹过头了答不上来,面试挂了事小,丢了面子事大。早知道就预习一下怎么吹嘘自己了。 252 | 253 | ## 四面 254 | 255 | - 介绍一下自己 256 | - 觉得自己基础知识掌握**怎么样** 257 | - 平时一般会用到哪些数据结构? 258 | - 链表和数组相比, 有什么优劣? 259 | - 如何判断两个无环单链表有没有交叉点 260 | - 如何判断两个有环单链表有没有交叉点 261 | - 如何判断一个单链表有没有环, 并找出入环点 262 | - TCP 和 UDP 有什么区别? 263 | - 描述一下 TCP 四次挥手的过程中 264 | - TCP 有哪些状态 265 | - TCP 的 LISTEN 状态是什么 266 | - TCP 的 CLOSE_WAIT 状态是什么 267 | - 建立一个 socket 连接要经过哪些步骤 268 | - 常见的 HTTP 状态码有哪些 269 | - 301和302有什么区别 270 | - 504和500有什么区别 271 | - HTTPS 和 HTTP 有什么区别 272 | - 写一个算法题: 手写快排 273 | 274 | 这一轮全程问的基础知识,基础扎实的话就没问题了,不过个人感觉有一点像校招的问法。 275 | 276 | ## 五面 277 | 278 | - 介绍一下自己 279 | - 在 k8s 上做过哪些二次开发? 280 | - 自己用 Helm 构建过 chart 吗?有哪些? 281 | - 有没有考虑过自己封装一个面向研发的 PaaS 平台? 282 | - 配置中心做了什么? 283 | - 为什么不用 zookeeper? 284 | - 配置中心如何保证一致性? 285 | - Spring 里用了单例 Bean, 怎么保证访问 Bean 字段时的并发安全? 286 | - 用并发安全的数据结构,比如 ConcurrentHashMap;或者加互斥锁 287 | - 假如我还想隔离两个线程的数据, 怎么办? 288 | - ThreadLocal,然后举了个例子 289 | - Golang 里的逃逸分析是什么?怎么避免内存逃逸? 290 | - 这个不知道,认怂了 291 | - 对比一下 Golang 和 Java 的 GC 292 | - 答了一下 CMS、G1和三色标记,我对比的点是 JVM 有分代回收,Go 的 Runtime 没有,没能深入地讲 293 | - Golang 的 GC 触发时机是什么 294 | - 阈值触发;主动触发;两分钟定时触发; 295 | - 有没有写过 k8s 的 Operator 或 Controller?(我:没有写过) 296 | - 谈一谈你对微服务架构的理解 297 | - 大体思路"微服务本质是人员组织架构演进与关注点分离" 298 | - 谈一谈你对 Serveless 的理解 299 | - 大体思路"Serveless 是继 docker 与容器编排之后的又一次应用开发与基础设施提供方之间的边界划分" 300 | - 你认为 Serveless 是未来吗? 为什么? 301 | - 大体思路"是云服务的未来,把蛋糕从企业的IT、运维与中间件部门切走,形成规模效应,做得越多赚得越多;公司内的话 servless 能够帮助加速前台业务迭代,但对中后台的收益还看不到,未来可能会有比 servless 更适合中后台的架构" 302 | 303 | - 面试官:最后你有什么要问我的? 304 | - 我:为什么足足安排了五轮技术面,而且其中有两轮似乎和 k8s 没有关系啊? 305 | - 面试官:我们觉得你做过的东西挺多的,各个方向都想让你尝试一下 (我的内心:......) 306 | - 我:那这轮是最后一轮技术面吗? 307 | - 面试官:不一定(我的内心:......) 308 | - 后续还问了面试官一些业务相关的问题,就不赘述了 309 | 310 | 五面最后的三个吹水问题我还挺感兴趣,可惜面试官只是听我讲,没有跟我讨论。还有就是问了面试官才知道,二面四面的面试官是 PaaS 平台那边的,因此主要问 Java 没有涉及到 k8s 和 go。 311 | 312 | ## 六面 313 | 314 | HR 面,之前就**听说**过阿里系的 HR 是来"闻味道的"(看你是否适合阿里的风格),而且有一票否决权。所以还是挺有压力的。 315 | 316 | - 问经历 317 | - 为什么要考虑出来看看呢? 318 | - 金句:"**现在自己的技术成长有点碰到瓶颈,加上一直对您公司钦慕有加☺️**"" 319 | - 现在公司的主营业务是什么?(这块往技术上问了很多,感觉是想考察我解释复杂问题的能力) 320 | - 现在带人吗?report 层级是怎样的? 321 | - 对自己这几年的经历满意吗? 322 | - 觉得自己有什么缺点? 323 | - 碰到过什么很挫败的事情吗? 324 | - 未来的职业规划是怎样的? 325 | - 看机会的时候,主要考虑的是待遇、平台、人员还是什么其他因素? 326 | - 现在的待遇如何 327 | - 有什么想问我的 328 | 329 | 整体聊了 40 多分钟,话题挺广的,面试官也说了系统部这边压力挺大的,优秀的人才才能留下来。个人觉得 HR 面里除了谈薪酬的部分没有什么可准备的,想说什么直说就行。因为到了 HR 面至少证明你的技术没什么问题,直说出来方便 HR 判断两边的价值观是否合拍,假如真的不合拍,**那其实在 HR 这一面挂了比起进去之后再后悔又跳槽要好很多**,毕竟大家都不喜欢频繁跳槽的简历。 330 | 331 | ## 小结 332 | 333 | 一些主观评价: 334 | 335 | * 面试难度:正常 336 | * 面试体验:正常 337 | * 问题偏向:基础知识,开发常识,技术见解 338 | 339 | 蚂蚁的面试风格比较"高冷",面试官给我的一致感受就是很强,卧虎藏龙。面试内容上在基础知识部分相对考察得多一些,没有偏门和猎奇的问题,基础知识扎实的同学可以大胆投投看蚂蚁。 340 | 341 | # 头条 342 | 343 | ![bytedance](/img/interview/bytedance.jpeg) 344 | 345 | * [面试前](#面试前-2) 346 | * [一面](#一面-2) 347 | * [二面](#二面-2) 348 | * [三面](#三面-2) 349 | * [四面](#四面-2) 350 | * [小结](#小结-1) 351 | 352 | ## 面试前 353 | 354 | 头条每次面试前会有 HR 约时间,并提前发一个 zoom 地址过来,三场技术面与一场 HR 面全都是视频面试。不得不说视频面试体验比电话面试好很多(尤其是对我这种很关注面试官反应的),假如有 HR 同学看到这篇文章,推荐考虑一下用视频面试取代电话面试,效率会更高。 355 | 356 | 头条的三场技术面风格都很类似: 357 | 358 | 1. 问项目,抓出一些你擅长的领域或场景 359 | 2. 问系统设计题,每题都会不断深化需求让你应变和权衡 360 | 3. 问一道算法题(不难不偏),先看思路,再要求写一下伪代码看边界条件能不能一次过 361 | 362 | 这个面试流程我自己也一直在用,尤其是系统设计加上不断的需求变更,能比较全面地考察后端的基本功和工程思维。因此头条的面试套路很对我胃口,甚至好多类似的问题我自己也都问过候选人。 363 | 364 | ## 一面 365 | 366 | - 介绍一下自己, 为什么选择出来看看机会 367 | - 聊项目, 警报怎么做的, 统一接入监控项怎么做的 368 | - 聊项目, 配置中心项目, 问实时配置推送怎么做 369 | - 讨论为什么选择所有的组件依赖放在配置中心中控制 370 | - 我现在要做一个限流功能, 怎么做? 371 | - 令牌桶 372 | - 这个限流要做成分布式的, 怎么做? 373 | - 令牌桶维护到 Redis 里,每个实例起一个线程抢锁,抢到锁的负责定时放令牌 374 | - 怎么抢锁? 375 | - Redis setnx 376 | - 锁怎么释放? 377 | - 抢到锁后设置过期时间,线程本身退出时主动释放锁,假如线程卡住了,锁过期那么其它线程可以继续抢占 378 | - 加了超时之后有没有可能在没有释放的情况下, 被人抢走锁 379 | - 有可能,单次处理时间过长,锁泄露 380 | - 怎么解决? 381 | - 换 zk,用心跳解决 382 | - 不用 zk 的心跳, 可以怎么解决这个问题呢? 383 | - 每次更新过期时间时,Redis 用 MULTI 做 check-and-set 检查更新时间是否被其他线程修改了,假如被修改了,说明锁已经被抢走,放弃这把锁 384 | - 假如这个限流希望做成可配置的, 需要有一个后台管理系统随意对某个 api 配置全局流量, 怎么做? 385 | - 在 Redis 里存储每个 API 的令牌桶 key,假如存在这个 key,则需要按上述逻辑进行限流 386 | - 某一个业务中现在需要生成全局唯一的递增 ID, 并发量非常大, 怎么做 387 | - snowflake (这个其实答得不好,snowflake 无法实现全局递增,只能实现全局唯一,单机递增,面试结束后就想到了类似 TDDL 那样一次取一个 ID 段,放在本地慢慢分配的策略) 388 | - 算法题, M*N 横向纵向均递增的矩阵找指定数 389 | - 只想到 O(M+N)的解法 **补充**: 这几天刷 leetcode 碰到这题了, [240. Search a 2D Matrix II](https://leetcode.com/problems/search-a-2d-matrix-ii/). 办法是从左下角或右下角开始查找. 390 | - 有什么想问我的? 391 | 392 | 限流,分布式锁,UUID 都属于后端的经典面试题,这轮面试的参考价值挺大的。 393 | 394 | ## 二面 395 | 396 | - 平时用的工具链和技术栈是什么 397 | - golang 踩过坑吗? 398 | - 答了之前 PingCAP 面试时面试官问的 for-range 里的 go-routine 闭包捕获问题 399 | - 这段 golang 代码有没有 bug(还是一个 for-range 的坑) 400 | - 有 bug,for-range 的 value 引用拷贝问题 401 | - Java 中 HashMap 的存储, 冲突, 扩容, 并发访问分别是怎么解决的 402 | - Hash 表,拉链法(长度大于8变形为红黑树),扩容*2 rehash,并发访问不安全 403 | - 拉链法中链表过长时变形为红黑树有什么优缺点? 404 | - 优点:O(LogN) 的读取速度更快;缺点:插入时有 Overhead,O(LogN) 插入,旋转维护平衡 405 | - HashMap 的并发不安全体现在哪? 406 | - 拉链法解决冲突,插入链表时不安全,并发操作可能导致另一个插入失效 407 | - HashMap 在扩容时, 对读写操作有什么特殊处理? 408 | - 不知道 409 | - ConcurrentHashMap 是怎么做到并发安全的? 410 | - segment 分段锁 411 | - Java 有哪些锁机制, 分别有什么特点? 412 | - Synchronized、可重入锁 413 | - 知道 CAS 吗? Java 中 CAS 是怎么实现的? 414 | - Compare and Swap,一种乐观锁的实现,可以称为"无锁"(lock-free),CAS 由于要保证原子性无法由 JVM 本身实现,需要调用对应 OS 的指令(这块其实我不了解细节) 415 | - MySQL 的存储引擎用的是什么?(InnoDB)为什么选 InnoDB? 416 | - 几乎所有公司用 MySQL 都用 InnoDB,降低踩坑成本;聚簇索引,MVCC 417 | - MySQL 的聚簇索引和非聚簇索引有什么区别? 418 | - 聚簇索引的叶子节点是数据节点(比如定义了主键时的主键索引),非聚簇索引叶子节点是指向数据块的指针 419 | - B+树和二叉树有什么区别和优劣? 420 | - B+树是多叉树,深度更小,B+树可以对叶子节点进行顺序遍历,B+树能够更好地利用磁盘扇区;二叉树:实现简单 421 | - 针对一个场景设计索引,具体场景忘记了,反正考察的是联合索引与列选择性的知识 422 | - 现有一个新的查询场景, 要怎么解决? 423 | - 假如要查 A in () AND B in (), 怎么建索引? 424 | - 只给选择性高的一列建索引,这里因为两个都是范围查询所以另一个是走不到索引的(这里答的不好,其实也可以建联合索引然后用 (A,B) in ((1,2),(3,4)) 的方式去查) 425 | - 查 A in () AND B in () 时, MySQL 是怎么利用索引的? 426 | - 先走一个非聚簇索引,查询出行数据后再用另一列回表做筛选 427 | - 假如查询 A in (), MySQL 是针对 N 个值分别查一次索引, 还是有更好的操作? 428 | - 不知道,有了解的同学可以留言 (补充, [@BillyLu](https://github.com/BillyLu) 贴出了文档 [equality-range-optimization](https://dev.mysql.com/doc/refman/8.0/en/range-optimization.html#equality-range-optimization), 大意是对非唯一索引 MySQL 会使用 index dive 的方式估算这个 range index 涉及的行数, 结合[where optimization](https://dev.mysql.com/doc/refman/5.7/en/where-optimization.html) 中说明的在走 index 时假如涉及行数过多会走 full table scan, 那么假如 estimation 认为这次 IN 不够好, 是会走全表扫描的. 不知道除此之外, 面试官还有没有想考察的点) 429 | - 用过 Redis 的哪几种数据结构? (都用过) ZSET 是怎么实现的? 430 | - 跳表 431 | - zrange start, stop, 总长度为 n, 复杂度是多少? 432 | - O(logN) (答得不好,实际是 O(M+log(N)), M 是结果集基数 stop-start) 433 | - Kafka 的消费者如何做消息去重? 434 | - MySQL 去重、Redis 去重、假如场景量极大且允许误判,布隆过滤器也可以 435 | - 介绍一下 Kafka 的 ConsumerGroup 436 | - 挺长的,略 437 | - Kubernetes 和 Docker 用得怎么样? (我:在公司推行布道) 438 | - 给它们贡献过代码吗?(我:没有...) 439 | - 时序型数据库的存储结构是怎么样的? 440 | - 讲了 prometheus 1.x 和 2.x 的存储结构 441 | - LSM 树了解吗? 是一种什么存储结构? 442 | - Log-Structured Merge Tree,牺牲读性能换取性能,RocksDB、HBase、Cassandra 都在用,结构有点忘了,只说了先写 memtable 再刷盘成 sstable 443 | - 在生产中用过 Cassandra 和 RocksDB 吗? 量有多大? 444 | - 用过,Cassandra 存调用链,RocksDB 做 flink 和 Kafka Stream 的本地状态存储 445 | - Cassandra 的墓碑机制是什么? 446 | - 不知道,对 Cassandra 停留在使用阶段 447 | 448 | 二面问了好多中间件的基础知识,最后都没有时间问算法了。面完之后心里就想:头条的面试真是耿直啊,Java 的 HashMap、锁机制、CAS 到 MySQL 的索引,Redis 的 zset,再到 LSM 树,全都是后端或中间件相关的热门面试题。当然这些问题热门也是有原因的,即使候选人准备过,多扣一点细节也能很快就能看出来候选人是真的理解还是仅仅只是看了相关资料。 449 | 450 | ## 三面 451 | 452 | - 聊项目和工作经验 453 | - 用 Kubernetes 的过程中踩过哪些坑? 454 | - 考虑一个业务场景: 头条的文章的评论量非常大, 比如说一篇热门文章就有几百万的评论, 设计一个后端服务, 实现评论的时序展示与分页 455 | - 我: 需不需要支持页码直接跳转? 456 | - 面试官: 支持和不支持两种场景都考虑一下 457 | - 我: 不需要支持页码翻页就传评论 id 用 offset 翻页 458 | - 假如用 id 翻页的方式, 数据库表如何设计? 索引如何设计? 459 | - (文章id, 评论id) 建联合索引,评论 id 需递增 460 | - 假如量很大, 你觉得需要分库分表吗? 怎么分? 461 | - 需要分,分表有个权衡,按文章 id 分表,读逻辑简单,但写有热点问题;按评论 id 分表,读逻辑复杂,但写压力就平均了。写是要首先保证的,而读总是有缓存等方案来折中,因此按评论 id 分表好。 462 | - 分库分表后怎么查询分页? 463 | - 每张表查 N 条数据由 client 或 proxy merge 464 | - 分库分表后怎么保证主键仍然是递增的? 465 | - 讲了 TDDL 的办法:有一张专门用于分配主键的表,每次用乐观锁的方式尝试去取一批主键过来分配,假如乐观锁失败就重试 466 | - 现在需要支持深分页, 页码直接跳转, 怎么实现? 467 | - 不能做精准深分页,否则压力太大,找产品进行妥协,在50或100页后数据分页是否可以不完全精确,假如可以,那么缓存深页码的起始评论 id 468 | - 瞬时写入量很大可能会打挂存储, 怎么保护? 469 | - 断路器 470 | - 断路器内部怎么实现的? 471 | - 可以用 ringbuffer 472 | - 断路器会造成写入失败, 假如我们不允许写入失败呢? 473 | - 先写进消息队列,削峰填谷异步落库 474 | - 算法题: N 场演唱会, 以 [{startTime, endTime}…] 的形式给出, 计算出最多能听几场演唱会 475 | - 先讲了思路, 按 endTime 升序排列,再顺序取最多场次 476 | - (讲完思路之后)屏幕共享给我, 用你最熟悉的语言把这个算法实现 477 | - 用 go 实现了一版 478 | - 你用了贪心法, 贪心可能会存在什么问题? 479 | - 局部最优,在这个问题里,只能找到一个可能解,无法找到所有排列方式 480 | 481 | 我觉得三面这个架构设计问得还不错,一个问题把后端的工程能力考的很全面了。 482 | 483 | ## HR 面 484 | 485 | 大同小异,问经历,问离职原因,问职业规划,问待遇,问期望。 486 | 487 | ## 小结 488 | 489 | * 面试难度:正常 490 | * 面试体验:挺好 491 | * 问题偏向:架构设计,算法 492 | 493 | 头条面试流程很专业:每轮都会提前约好时间,面试时长都在40~50分钟,按时开始面,每轮之后发反馈短信邀请候选人评价面试,精准地过两天再约下一轮。整个像一台精密运作的机器。头条的面试我个人挺欣赏的,考察得比较全面,面试官会抓住你没有说清楚的地方来深入或者变换场景让你应变,大家可以试试看去面一下,即使不打算去也可以作为一次免费的能力评定。 494 | 495 | 再说说面试官,每位面试官都听得出来是在一线写代码的,而且很认真地在听我说话(这当中有视频的功劳,我可以看到面试官在认真听),感觉工作中也都会是好相处好合作的类型。 496 | 497 | # 总结 498 | 499 | 回头看面试的过程,有好多不尽如人意的地方,不过最后能够拿到三家的 offer 还是很幸运。最后再做一些补充性的小结: 500 | 501 | 一些经验: 502 | 503 | * **简历里写了的项目,以及熟练程度在"掌握"以上的领域与中间件要好好准备**,当面试官问你一个偏门的问题时,他内心其实也没希望你能答上来。而当面试官问你简历上涉及的问题时,假如你答不上来,那面试官就觉得这个人要么是眼界太低,会了一点就觉得自己掌握了,要么是简历造假在胡吹,这两种都非常不利; 504 | * 在上一条的基础上,**可以准备一个最得意的项目**,在简历上和面试过程中引导面试官往这块聊; 505 | * 面试前心里可以准备一个方法论:**明确面试官想招怎样的人有哪些特质,在面试过程中努力表现出这些特质**。这听起来是句正确的废话,但面试的过程不可控因素太多,有一个清晰的目标在脑子里能帮你在手足无措时想到说什么。举个例子,有一轮中面试官问我有什么问题时,我就问贵司的对应岗位会面临哪些技术挑战(当然要先说清楚这不是在质疑他们没有挑战,只是自己渴望挑战); 506 | 507 | 一些各领域的资料与心得: 508 | 509 | * [System Design Primer](https://github.com/donnemartin/system-design-primer),入门架构设计必看的一篇资料。看完之后提醒自己始终记得:架构设计的本质是深入理解业务场景之后用工程经验做出最佳权衡。面试时的一个套路是先提纲挈领地把**舍弃什么来换取什么**讲明白; 510 | * 云原生相关,[Kubernetes Concepts](https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/) 部分建议再看一遍,源码部分推荐看 apiserver 中的 CRD 部分与 aggregation layer、kubelet 的 pod 状态同步、scheduler 的调度部分以及[Sample Controller](https://github.com/kubernetes/sample-controller) 如何写一个自己的 controller 511 | * 语言方面,推荐看书《Effective Go》《Effective Java》,都很薄。这两本书我是以前看的,面试前没有专门准备语言相关; 512 | * 算法相关,这部分我纯鶸,说实话我觉得大学里那本教材《数据结构与算法分析》就写得很不错...至于 leetcode,面试前没有刷过,最近为了练习 Rust 刷了60多题,并没有碰到面试里出现过的题目,看起来要刷 leetcode 的话就得走量多刷点,刷的少纯拼强运了; 513 | * [Golang for range 的坑](https://studygolang.com/articles/9701) 有两轮面试都涉及到了这个话题,这里贴一下; 514 | 515 | repo 关闭了 issue 功能, 您可以在 [我的博客](https://aylei.github.io/blog/interview-experience/) 中进行相关讨论(不过目前 heading anchor 还没加上, 阅读体验不如 github 的 md), 也可以直接通过我的邮箱(见 profile)进行交流, 感谢您耐心地看完全文! 516 | 517 | **补充** 518 | 519 | 笔者最后去了 PingCAP, 原因也很简单, **大公司想去总是能找到机会去的, 而登上 Rocketship 的机会可不多** 520 | 521 | 这里也打个广告, 假如想一起来搞 [TiDB](https://github.com/pingcap/tidb), 欢迎发送简历到 wuyelei@pingcap.com, 我帮您内推😆(多嘴提一个邮件礼仪的小建议: 标题一定要写清楚😂), 这里是 [相关JD](https://www.pingcap.com/recruit-cn/engineering/bizdev-cloud-engineer/) 522 | 523 | 另外, 蚂蚁的 Kubernetes 调度部门也在招人(社招校招都有), Leader 是我一个很靠谱的学长, 大家可以直接发送简历到 tongkai.ytk@antfin.com 内推. [相关 JD](./docs/antfin_k8s_jd.md) 524 | 525 | (全文完) 526 | 527 | [*License under CC BY-NC-ND 4.0: 署名-非商业使用-禁止演绎*](https://creativecommons.org/licenses/by-nc-nd/4.0/deed.zh) 528 | --------------------------------------------------------------------------------