Documenting an Alibaba interview with a heroic sacrifice

640?wx_fmt=gif&wxfrom=5&wx_lazy=1

Hot Article Guide |  Click on the title to read

Welcome to Java and Android Architecture Knowledge Planet

so cool! 74 APP complete source code!

How can programmers improve themselves when they encounter bottlenecks?

Today was a sunny day, with birds chirping and flowers fragrant. So I decided to feel the spring sunshine while shopping. At 7 o'clock in the evening, the back-end boss of Ant Financial called for a round of technical interviews. I have a black question mark on my face? ? ? Are interviews popular now?


So my first interview journey began with a splendid start.

Self introduction

First of all, let me introduce myself in two minutes. I thought I could go on and on and introduce myself in all directions, treating the other person as a blind date. In less than half a minute, I finished the introduction==.

After five seconds of silence, the boss hummed.

I felt an embarrassed but polite smile on my face.

Recent project experience

At this time, the boss asked me what projects I have been working on recently, and what kind of work I have done in the postgraduate stage.

That has to be blown away! From the origin of JAVA to the development of Spring to the use of jenkin, I mentioned dva+antd by the way, the result arrived in half a minute, and I couldn’t go on.==

The boss patiently listened to me saying a bunch of incoherent words and started to get to the point.

Spring

Big guy: I see that you have used this Spring. Why do we use Spring?

Me: (because everyone said yes) First of all, spring is a huge framework, it encapsulates many mature functions so that we don't need to repeat the wheel. Secondly, it uses IOC for dependency management, so we don't have to initialize the instance ourselves.

Big guy: (I knew you would say IOC) Then explain IOC

Me: IOC is the transformation of dependency control, using the reflection mechanism of JAVA, the initialization of the instance is handed over to Spring. Spring can manage instances through configuration files.

Big guy: Then we can use the factory mode directly. The factory pattern can also manage the initialization of instances. Why do you have to use Spring?

Me: Ah....because....convenient? (As if seeing the big guy's frozen expression, in order not to be so embarrassed, I decided to change the subject). And spring's IOC is a singleton mode.

Big guy: Is the implementation a singleton mode by default?

Me: Right.

这里查了一下为什么不用工厂模式而使用IOC。其实本质上还是因为IOC是通过反射机制来实现的。当我们的需求出现变动时,工厂模式会需要进行相应的变化。但是IOC的反射机制允许我们不重新编译代码,因为它的对象都是动态生成的。

数据库

大佬:你使用过哪些数据库呀?

我:mysql还有sqlight。(被遗忘的mongodb在角落里无声哭泣)

大佬:那你使用的ORM框架除了hibernate还有哪些,比如IBatis?

我:我用过MyBatis

大佬:哦,那你能讲一下你对两个框架使用后的感受吗?

我:当时使用Mybaits的时候,也有去社区了解了一下两个框架的口碑,发现大家的战队都坚定而对立。对Hibernate的不满通常是因为它在复杂关联中往往会带来严重的性能问题,也就是N+1的问题。但是它是面向对象支持的最好的框架了。而Mybatis则相对而言比较易于使用,只需要会SQL语句就行了。但是也意味着会破坏一些面向对象的规则。

大佬:(似乎有点认可)那你了解数据库的事务吗?能讲一下数据库的事务级别吗?

我:(忘得一干二净)emmm不好意思我记不太清楚了。

大佬:那你还记得数据库的加锁吗?比如乐观锁,悲观锁?

我:(求您别问了T T)

大佬:(锲而不舍)那我现在假设有一张用户表,你也知道,正常的表只能存放大概一千万或是两千万左右的数据。但是阿里巴巴有上亿的用户?你会怎么存储呢?

我:可以纵向分割与横向分割。

大佬:那你觉得这里应该纵向还是横向呢?

我:纵向(载入史册的嘴瓢)

大佬:(很有耐心)可是这样我的数据库还是放不下啊

我:(仿佛突然睡醒)应该是横向分割,把表拆分成多个表然后分布式存储

大佬:那你觉得我们怎样分割比较合适呢?

我:(还能再问?)可以根据地域,但是根据用户分布的情况来说,还是会有某些地域访问稠密而有些地域比较稀疏的问题。难道按照用户等级?

大佬:不,用户等级会变动,不合适。你这个阶段暂时没有考虑这个问题

我:(谢谢您的台阶啊!)

Linux

大佬:你们服务器用的是什么操作系统啊?

我:(呀,送命题)我们用的是阿里云上的centos系统

大佬:那你对linux熟练吗?

我:不是很熟悉,仅仅是入门,能够敲一点指令。

大佬:好,那你知道库函数和内核调用吗?

我:内核调用是指进入内核态然后执行指令然后再回到用户态吗?

大佬:对

我:我知道的大概就这么多了,只了解一些概念上的内容。(凉凉送给自己)

大佬:那你知道如何查看进程吗?

我:啊…记不得了,我一般都查一下指令(于是大佬果断放弃了其它linux问题)。

JVM

大佬:你了解JAVA虚拟机吗?能解释一下底层的模块吗?

我:(如果你通知我明天面试,我就了解了><)不好意思,这一块知识我不熟悉,但是我很愿意去了解(赶紧表忠心啊!)

线程

大佬:你知道什么是线程安全吗?

我:(乌鲁乌鲁说了一堆)就是比如如果同时有两个线程访问同一个变量,那么它们对变量造成的修改所带来的结果可能是不确定的。

大佬:那你知道JAVA有什么方法来实现线程安全吗?

我:(前几天还翻译了博客,但是一问起来忘得比啥都快)首先是synchronized修饰词,然后JAVA还自己实现了一些封装好的类比如LatchDown,Atomic系列(????????后来一查是CountDownLatch!还有大明湖畔的final关键字呢?还有小明湖畔的Lock呢?还有那些实现线程的collections比如ConcurrentHashMap呢?)

大佬果然开启了下一个问题。

分布式

大佬:你有写过分布式的业务吗?

我:我写过一个基于HDFS分布式存储的KVStore,上层使用Hadoop的API实现。

大佬:那个是分布式存储,我想了解一下分布式业务?

我:(赶紧纠正)那dubbo算吗?(于是介绍了一下自己了解的dubbo)

大佬:ok。那你觉得分布式的话会遇到什么问题呢?

我:那就是经典的CAP问题了。没有数据库能够同时满足这三个问题

大佬:那你能具体解释一下CAP代表什么吗?

我:(紧张到一片空白)Consistency?Atomic?P…Persistency???

大佬:。。。。。。

CAP: refers to Consistency consistency, Availability availability, Partition Tolerance partition tolerance

Design Patterns

Boss: Have you ever heard of design patterns?

Me: understand understand

Big Brother: So what design patterns have you learned about?

me: blablabla

Boss: Then explain the command pattern

Me: This is a bit like the idea of ​​functional programming. The instruction mode refers to encapsulating each operation into a unified interface and providing the implementation class of each operation. In this way, we only need to program for the command interface, which releases the strong coupling between the calling class and the instruction.

Summarize

In the end, of course, talk to the boss and make a final struggle. In conclusion, to successfully conduct an interview with Alibaba, you need to know and even master the following:

  • JAVA language, especially threads

  • JVM principle

  • Database (transactions, locking, ORM)

  • Linux

  • Spring (emphasis!)

  • distributed

  • Design Patterns

It can be said that the scope is very wide. But in fact, if you want to become an excellent back-end developer, you need these kinds of knowledge, and you can only say that you are still too bad. Keep learning!

Original http://www.techug.com/post/a-interview-in-alibaba.html

If you have a good article that you want to share with you, you are welcome to contribute, just send me the article link directly


Finally, everyone is welcome to join our knowledge planet. The second phase is in full swing, and nearly 1,000 people have joined the study :

Everyone is welcome to join as soon as possible. This period ends on March 10, 2019, so the sooner you join, the better. The promotion ends. The current entry fee has been raised from 79 yuan to 89 yuan, and the fee will increase by 10 yuan for every 100 people in the future~

640?wx_fmt=jpeg

Scan WeChat or click the QR code above to get Android\Python\AI\Java and other advanced resources

For more learning materials, click "Read the original text " below

640?wx_fmt=gif

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325346023&siteId=291194637