Internet companies in mind certain electricity supplier senior java interview

Thanks handsome propane before writing, is very helpful (especially redis) technology stack depth I

Article answer is not the standard answer, is I had the answer

 

one side

Interviewer: You've done projects under the brief.

White: slightly (mainly SpringCloud, redis, message queues)

Interviewer: ok, I ask basic things point to learn about design patterns?

White: single embodiment mode used, the factory mode, the observer mode.

Interviewer: Can you say singleton pattern, which has several implementations do next?

White: lazy man, hungry man, double-check.

Interviewer: HashMap data structure to understand it?

White: jdk1.7 + is an array of linked lists, jdk1.8 list is an array + + red-black tree. Size = 8 to expand the list will list into red-black tree, the insertion head to tail insertion.

Interviewer: I suppose these data are just happens to be inserted into a linked list, how do?

White: That expansion it.

Interviewer: In addition to the expansion of it?

White: You can override the hashcode approach?

Interviewer: Yes, that's the answer I wanted. When you talk about objects for equality Why override equals and hashcode methods?

White: For example, these two objects are equal, only override the equals method without overwriting hashcode method will be found in the map when it is placed in two key, contrary to the two objects are equal, causing distress

Interviewer: hashMap support concurrent it?

White: does not support, you can use hashTable and concurrentHashMap instead.

Interviewer: What do you tell the difference between They

White: hashTable hashMap is based on the method of adding the synchronized lock, lock segment concurrentHashMap done using segements at jdk1.7, using synchronized + CAS lock is achieved when jdk1.8

Interviewer: CAS how to achieve lock?

White: marked by volatile variables ensure visibility, to ensure that each data is the latest to get the data, do the comparison at the time of the update, if you have not been changed, then update.

Interviewer: This is the optimistic or pessimistic lock lock?

White: optimistic locking.

Interviewer: how redis Distributed Lock project implementation?

White: According to custom request id and key to generate, as a key into his redis, and then deleted after completion of the operation to release the lock.

Interviewer: What if I did not finish how to do? Not to form a deadlock?

White: key will set the expiration time.

Interviewer: direct delelte key delete key is it?

White: No, in order to ensure atomicity luna script is placed in redis execution.

Interviewer: redis and memoryCache What is the difference?

White: redis support persistence, memoryCache does not support, if hung up the data inside it is all gone.

Interviewer: Anything else?

White: I do not understand memoryCache, not used.

Interviewer: redis is single-threaded or multi-threaded?

White: It should be single-threaded bar

Interviewer: Yes, the point of self-confidence, or how to implement a distributed lock it. You Equipment Directive issued how to ensure the safety of it? If you can not be intercepted easily break it?

White: data sent is encrypted.

Interviewer: Do you know which encryption methods it?

White: the MD5 for example, one-way encryption, password can not be stored as a database stored in plain text, it is generally stored data md5 encryption. There RSA encryption, he was encrypted with the public key, private key to decrypt, so he can get to the plaintext.

Interviewer: thread pool has to find out about it? How to achieve.

White: You can get the thread pool with Executors, also new threadPoolExecutor.

Interviewer: They so what's the difference?

White: former Ali in the development of norms had been rejected, because it will unlimited expansion, so it can recommend the latter.

Interviewer: Do you know threadPoolExecutor what parameters it?

White: Survival number of threads, the maximum number of threads, and two are dead time, a queue, there is a thread factory and error strategy.

Interviewer: What do you want to ask it?

White: There will do technology sharing

Interviewer: This is there, every week will be held on a regular basis to share, there are many large cattle will introduce their experience.

 

 

Two faces

Your experience was introduced to the project: the interviewer

White: slightly.

Interviewer: There are too complicated by the scene before encountered it?

White: Yes, equipment instructions simultaneously issued a batch, hit collapse over the database.

Interviewer: Why fight collapse

White: Because at the same time a large area of ​​reids key failure, all requests are hitting the database.

Interviewer: how to solve it?

White: to process data in batches, diverge redis key expiration time.

Interviewer: did not find it before such a big problem?

White: This occurs in the development environment, production environment will not have this problem.

Interviewer: You redis is how to achieve?

White: AOP interception interfaces with a large screen, and if there are redis data is returned, if no further access to the database.

Interviewer: I see you have experience tuning project experience, that if you talk about a slow return to the interface how to start tuning?

White: hit the breakpoint, and see where the major time-consuming, if slow background processing, they have specific analysis, change the code, it is necessary to perform analysis if slow sql sql, sql rewriting or indexing.

Interviewer: sql slow how you analyze it?

White: You can turn on slow query log, confirmed the slow implementation of sql then explain, he did not go to see the index, or the full table scan.

Interviewer: explain a few major Behold parameters?

White: There are a number of lines scanned through the rows represent, what all other like, on behalf of all if there is a full table scan.

Interviewer: Index fail to understand it? Talk about what the next scene will fail Index

White: for example, using in, not in, or do the calculation functions on indexed fields are likely to occur index fail.

Interviewer: Under what circumstances would fail joint index it?

White: If time is established A, B when the query with B, A will fail.

(Later I asked a lot of scenes, such as CBA, BCA)

Interviewer: Do you have a stress test done?

White: Yes

Interviewer: What are the main indicators to see it?

White: QPS, as well as the error rate.

Interviewer: If the pressure test results are not how to do it?

White: Front limiting, limiting the back-end, jvm set the number of concurrent threads.

Interviewer: I see you with the project is springcloud, blown downgrade how to achieve?

White: the introduction of Hystrix, then he can go to intercept the wrong interface, return-defined error is returned.

Interviewer: What do you know blown argument?

White: There are a number of minutes, the number of errors, fusing time now.

Interviewer: So how do you improve the throughput of your interface yet.

White: use eureka do load balancing, such as high concurrency of this equipment module can be more than a few micro-start service.

Interviewer: load balancing allocation policy, what does?

White: polling, randomized, concurrent least, that several English forgotten.

Interviewer: Why did SpringCloud it? dubbo can ah

White: indeed, it was rather awkward, dubbo Ali has not been restarted, and dubbo use the RPC, springCloud use the http, and everyone on spirng more familiar with, so use SpringCloud

Interviewer: Talk to your RPC it?

White: is a remote procedure call. I did not know the specific

Interviewer: Java RPC how to achieve it?

White: No

Interviewer: What development tools used?

White: IDEA

 

 

 

Three sides

Interviewer: The next project experience

White: slightly

Interviewer: You sql table has the largest number of data?

White: hundreds of thousands.

Interviewer: I see the device have been reported data table unlimited growth, why so little amount of data.

White: do the separation of hot and cold data, database data retaining only three days, before the data is written as a csv file name stored by date

Interviewer: I want to how data a month ago to do?

White: We provide the interface to obtain data, csv json data is stored in, so you can still query.

Interviewer: That's certainly a lot of respect to the sql query slow it.

White: That's for sure, so try to support some of the data segment extraction, do not have any complex operation, similar to tsdb.

Interviewer: Do you think you have any disadvantages? (Send proposition)

White: compare stubborn, with my colleagues will want to plan out an optimal solution to noisy.

Interviewer: If the sake of discussion, then I support, but be careful way of speaking, try to moderate a bit. What do you think your strengths it?

White: strong ability to accept new things now, the company recently let me develop some front-end content, although not before contact can also copy or imitate.

Interviewer: What do you usually learn some of the techniques are the channels by which it?

White: csdn, micro-channel public numbers such as Ali, technology, road infrastructure and the like, github project will look at some related or similar projects.

Interviewer: You do not see some professional books?

White: compared to professional books I like to watch the history books. Because now technology upgrading so fast, I could read a book and realize the principles have changed, such as the difference between hashmap jdk1.7 and 1.8.

Interviewer: reading program can actually train your mind, simply look at some of the articles, then in many cases will forget, after reading about the best code, in order to consolidate

White: Learn

Interviewer: What do you think of the overtime it?

White: I think the Internet who work overtime is normal, doing their own thing good and then after work. But I am more disgusted with nothing obviously still pretend that something in overtime, or their own ability to not then put the poor.

Interviewer: Before there is extraordinary with it? To talk about the project from the project to the end of the process

White: slightly (each company are not the same)

Interviewer: What do you want to ask it?

White: As mentioned in overtime, I would like to ask corporate performance and overtime tied it?

Interviewer: Definitely not linked.

White: I have no problem here

Interviewer: Wait hr Contact

 

 

 

Summary : the side surface of the broad, mainly on the technology used in the project to be a general understanding, under judge you really will use, touch your foundation. Then two faces will be inquisitive, to dig a technology stack your level of understanding as well as some of the architectural design. Is more water on three sides, not much technical problems, determine whether you meet at the company culture.

 

Follow-up: get the offer data station sector.

 

 

 

 

 

 

 

 

 

 

 

 

Released seven original articles · won praise 5 · Views 3461

Guess you like

Origin blog.csdn.net/babing18258840900/article/details/104294933