Author: raledong reference: https://segmentfault.com/a/1190000013329013
One, foreword
Today was supposed to be a sunny day, with birds singing and flowers. So I decided to soak up the spring sunshine while shopping. At 7pm, the head of ant Financial’s back end called for a round of technical interviews. I have black question marks on my face?? Are surprise interviews all the rage these days? So my first interview journey, this heroic launch.
Two, self-introduction
First, the big guy asked me to introduce myself in two minutes. I thought I could talk a lot, introduce myself as if I were dating someone. In less than half a minute, I was done.
After five seconds of silence, the big man said, HMM.
I felt an awkward, polite smile spread across my face.
Iii. Recent project experience
At this time, the big guy asked me what projects I had been engaged in recently and what kind of work I had done during the postgraduate period. That must be blown! From the origin of Java to the development of Spring to the use of Jenkins incidentally mention a mouth dVA + ANTd, the result of half a minute, again can not go on ==
The big guy very patiently listened to me say a bunch of incoherent words, began to get to the point.
Four, Spring
Big man: I see you have used Spring before. Why do we use Spring? Me :(because everyone says yes) first of all, Spring is a huge framework that encapsulates a lot of mature functionality so that we don’t have to reinvent the wheel. Second, it uses IOC for dependency management, so we don’t have to initialize instances ourselves. IOC means relying on control transformation, using Java’s reflection mechanism, to hand over the initialization of instances to Spring. Spring can manage instances through configuration files. Big man: Then we can just use the factory mode. Factory mode also manages instance initialization, so why use Spring? I: ah… Because… It’s convenient? (As if to see 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. Big man: Is the default implementation singleton? Me: That’s right.
Here is a look at why IOC is used instead of factory mode. In essence, IOC is achieved through reflection. When our requirements change, the factory model needs to change accordingly. But IOC’s reflection mechanism allows us not to recompile the code because its objects are dynamically generated.
V. Database
Big man: What databases have you used? Me: MySQL and SqlLite. (The forgotten MongoDB is crying silently in the corner) Big Guy: What ORM frameworks do you use besides Hibernate, like iBatis? Me: I have used MyBatis. Big Guy: Oh, can you tell me your feelings after using the two frames? Me: When I was using MyBatis, I also went to the community to know the reputation of the two frameworks, and found that everyone’s team was firm and opposite. Complaints about Hibernate are usually due to the fact that it tends to cause serious performance problems in complex associations, namely N+1 problems. But it is the best framework with object-oriented support. MyBatis, on the other hand, is relatively easy to use, requiring only SQL statements. But it also means breaking some object-oriented rules. Big guy :(seems to agree) do you know anything about the database? Can you talk about the transaction level of the database? Me :(completely forgotten) emmm sorry I can’t remember exactly. Big man: Do you still remember the locking of the database? Like optimistic lock, pessimistic lock? I :(please don’t ask T T) boss :(perseverance) now I assume that there is a user table, you know, the normal table can only store about 10 million or 20 million data. But Alibaba has hundreds of millions of users? How would you store it? I: can be vertical segmentation and horizontal segmentation. Big man: Do you think this should be vertical or horizontal? I: vertical (in history) big guy: (very patient) but I still can not put in the database ah: (as if suddenly woke up) should be horizontal partition, split the table into multiple tables and then distributed storage big guy: so how do you think we split more appropriate? Me :(can I ask again?) It can be based on geography, but depending on the distribution of users, there will still be some areas where access is dense and some areas are sparse. By user level? Big man: No, the user level will change, not appropriate. I :(thank you for your step!)
Seven, Linux
Big man: what operating system does your server use? I: (ah, send proposition) We use Cent OS system on Ali Cloud. Big guy: Are you familiar with Linux? I: not very familiar, just the entry, can knock a little instruction. Big guy: Ok, do you know library functions and kernel calls? Me: Does a kernel call mean going into kernel state and executing instructions and then going back to user state? Big guy: To me: THAT’s about all I know, just some conceptual content. Big guy: Do you know how to check the progress? Me: oh… I can’t remember, I usually look up instructions.
Eight, the JVM
Big Man: Do you know anything about JAVA virtual machines? Can you explain the underlying modules? I :(if you inform me of the interview tomorrow, I will understand ><) sorry, I am not familiar with this area of knowledge, but I would like to learn.
Nine, thread
Big man: Do you know what thread safety is? For example, if there are two threads accessing the same variable at the same time, the changes they make to the variable can be uncertain. Big man: Do you know of any methods that JAVA has to implement thread safety? Me :(I translated the blog a few days ago, but forgot about it faster than anything else) first synchronized modifiers, and then JAVA implements its own wrapped classes such as LatchDown, Atomic series (????????) Later it was CountDownLatch! What about the final keyword of Daming Lake? And the Lock by xiaoming Lake? What about Collections that implement threads, such as ConcurrentHashMap?) (Sure enough, the boss opens the next question)
X. Distributed
Big Man: Have you ever written about distributed businesses? Me: I wrote a KVStore based on HDFS distributed storage, and the upper layer uses Hadoop APIS to implement it. Big man: That is distributed storage, I want to know about distributed business? Me :(corrects quickly) does Dubbo count? (Then introduces Dubbo) Big guy: OK. So what do you think is the problem with distributed? Me: That’s the classic CAP problem. No database can satisfy all three: can you explain exactly what CAP stands for? Me :(tense to blank) Consistency? Atomic? P… Persistency??? Bosses:…
CAP: Consistency, Availability, and Partition Tolerance
11. Design mode
Big Man: Have you ever learned about design patterns? Big Guy: What design patterns have you learned? Me: Blablabla Big Guy: Then explain the instruction pattern me: It’s kind of like the idea of functional programming. The instruction pattern is to encapsulate each operation as a unified interface and provide implementation classes for each operation. This removes the strong coupling between the calling class and the instruction by simply programming to the Command interface.
Xii. Summary
Finally, of course, and the big guy talk a small talk, the last struggle. To sum up, in order to conduct a successful interview with Alibaba, you need to know and even master the following:
-
The JAVA language, especially threads
-
The JVM principle
-
Database (transaction, locking, ORM)
-
Linux
-
Spring (important!)
-
distributed
-
Design patterns
It’s a very wide range. But in fact, to become a good back-end development, is the need for these knowledge, can only say that they are too vegetables. Keep studying!
If there are any improper articles, please correct them. You can also follow my wechat official account: Learn Java well and get high-quality video tutorial resources.