Distributed JVM + + algorithm + lock + MQ + service + micro database interview questions

JAVA foundation

1. What are several basic data types JAVA is, how many bytes each occupation

Java basic data types 8 species:

  

Glossary:

 bit: bit, the smallest unit of computer data storage, a number of bits in the binary number.

 byte: byte, the basic unit of computer data storage, a byte consists of 8-bit binary number. Typically a character is two bytes.

2, String class can inherit it, and why.

 

No, because the String class has final qualifier, while the final modified class can not be inherited, the implementation details are not allowed to change.

About final modifier, described as follows:

According to the program context, Java keyword final of "It can not be changed" or "final state" meaning it can be modified non-abstract class, non-abstract class member methods and variables. You may need to stop for two understandings change: design or efficiency. 
  final class can not be inherited, no sub-class, the default class final method is final. 
  final methods can not override methods by subclasses, but can be inherited. 
  final member variable represents a constant, can only be assigned once, after the value assigned does not change. 
  method can not be used to modify the final construction. 
  Note: private members of the superclass method is a class method can not quilt cover, so the private type of method is the final type of default.

If a class is not allowed to overwrite a subclass method, this method can be declared final approach. 
  There are two reasons for the use of final approach: 
  First, the lock method to prevent any inheriting class to modify its meaning and implementation. 
  Second and efficient. Compiler encounters when it will call the final method built into the mechanism, greatly improving efficiency.

 

 3 difference, String, Stringbuffer, StringBuilder is.

 4, ArrayList and LinkedList What is the difference

 

 5, examples of the talk order class, such as the parent class static data constructors, fields, subclass static data constructors, fields, the time when new, their order of execution

 

6, which used the Map class, what's the difference, HashMap is thread-safe for you, what is the use of concurrent Map are and what they are internal principles, such as storage, hashcode, expansion, default capacity.

 

7, JAVA8 of ConcurrentHashMap Why give up the sub-lock, what is the problem, and if you come to design, how to design.

 

8, there is no sequential Map implementation class, and if so, how to ensure that they are ordered.

 

9, the difference between abstract classes and interfaces, what classes can inherit multiple classes, interfaces, multiple interfaces can inherit it, what class can implement multiple interfaces.

 

10, inheritance and the difference between where the polymerization.

 

11, IO model which, nio talk about your understanding of the difference between him and bio, aio is valid to talk about reactor models.

 

 12, the principle of reflection, reflecting what three ways to create a class instance yes.

 

13, reflection, and the Class.forName ClassLoader difference.

 

14, describe the dynamic proxy several implementations, each corresponding spoken disadvantages.

 

15, dynamic agent and cglib achieve distinction.

 

16. Why CGlib ways to implement proxy for interface.

 

17, final use.

 

18, three kinds of write modes to achieve a single embodiment.

 

19, how in the parent class subclass automatically complete all the hashcode and equals to achieve? What do the pros and cons.

 

20, please combined with OO design, talk about access modifiers public, the role of private, protected, default in application design.

 

21, deep and shallow copy copy distinction.

 

22, and an array of linked list data structure described, each time complexity.

 

23, the difference between error and exception, CheckedException, the difference of RuntimeException. Please list the runtime exception 5.

 

24, in your code, if you create a java.lang.String class that can be loaded if the class loader? why.

 

25, talk about your understanding of java.lang.Object object hashCode and equals methods. Under what scenarios need to implement these two methods.

 

26, in jdk1.5, the introduction of generics, generics presence is used to solve the problem.

 

27, so what's the use of a.hashcode, have anything to do with a.equals (b). There may be two unequal objects have the same hashcode.

 

28, in the interior of Java HashSet how it works.

 

29. What is serialization, serialized how and why serialization, deserialization encounter any problems, how to solve.

 

30, java8 of new features.

 

JVM knowledge

1, under what circumstances stack memory overflow occurs

 

2, JVM memory structures, Eden and Survivor ratio.

 

3, JVM memory into why the new generation, the old era, lasting generations. Why the new generation into Eden and Survivor.

 

4, JVM in a full GC process like, how objects promoted to the old era, you know, talk about several major JVM parameters.

 

5. Do you know what kinds of garbage collectors, their advantages and disadvantages, and highlight some of the lower cms G1, including principles, processes, strengths and weaknesses.

 

6, to achieve the principle of garbage collection algorithms.

 

7, when there is a memory overflow, how do you debug.

 

 8, knowledge of JVM memory model to understand how much, such as reordering, memory barriers, happen-before, main memory, working memory and so on.

 

9, simply talk about your understanding of the class loader can delegate it to break the parents, how to break.

 

10, talk about the reflection of JAVA.

 

11, g1 and cms difference, the throughput of priority and in response to selection priority garbage collector.

 

12, how to play thread stack information.

 

13. Please explain the meaning of the following jvm argument:

-server -Xms512m -Xmx512m -Xss1024K

-XX:PermSize=256m -XX:MaxPermSize=512m -

XX:MaxTenuringThreshold=20XX:CMSInitiatingOccupancyFraction=80 -

XX:+UseCMSInitiatingOccupancyOnly。

 

 Open source framework for knowledge

1, simply talk about tomcat structure, as well as its class loader processes, threading model.

 

2, tomcat how to tune, which parameters involved.

 

3, talk about Spring loading process.

 

4. The principle of Spring AOP.

 

5, talk about the propagation properties Spring transaction.

 

6, Spring how to manage affairs.

 

7, Spring how to configure a transaction (specifically say some of the key elements of xml).

 

8, talk about your understanding of Spring, non-singleton injection principle? Its life cycle? Loop injection principle, aop implementation principle, talk about a few aop in terms of how they work with each other.

 

9, Springmvc DispatcherServlet in the initialization process.

 

10, netty's threading model, based on how netty reactor model implementation.

 

11. Why netty.

 

12. What is TCP stick package, unpacking. What is the solution way it is.

 

13, netty of fashwheeltimer usage, implementation principles, whether there had been insufficient time to call, how to solve.

 

14, netty heartbeat process how to do in the weak net.

 

15, netty communication protocol is what.

 

16, springmvc used notes, what is the role of principle.

 

17, springboot start mechanism.

 

operating system

1, the Linux system you concerned about what kernel parameters, to talk about you know.

 

2, Linux model at IO There are several, what their meaning yes.

 

3, epoll and poll What is the difference.

 

4, which usually use the Linux command.

 

5, see the last five lines of the file with the command line.

 

6, the output java process running with one command.

 

7, the operating system was introduced to thread your understanding of the handover process.

 

8, the difference between processes and threads.

 

9, after the top order have what, what role.

 

10, online high CPU burst, how you find the problem.

 

Multithreading

1, several multithreaded implementation, what is thread-safe.

 

2, volatile principle, effect, you can lock it in place.

 

3, draw a thread of life cycle state diagram.

 

4, the difference between sleep and wait.

 

5 distinction, sleep and sleep (0) is.

 

6, the difference between Lock and Synchronized.

 

7. What synchronized principle is generally used in any place (such as the time difference added to the static methods and non-static methods, static methods and non-static method executed simultaneously have an impact on it), explain the following terms: re-ordering, self spin locks, lock bias, lightweight lock, reentrant lock, lock fair, unfair locks, optimistic locking, pessimistic locking.

 

8, which atoms class used, what their principle yes.

 

9, JUC studied under which concurrency utilities, talk about the principle.

 

10, used the thread pool, and if used, please explain the principles and talk about newCache and newFixed What is the difference, what is the meaning of each parameter constructor is such coreSize, maxsize and so on.

 

11, shut down the thread pool there are several ways, the difference between what each yes.

 

12, if there is a third party interface, there are many threads to call to get data, now up to 10 per regulations threads simultaneously call it, how to do it.

 

13, spring the controller is a single case or multiple cases, how to ensure the safety of concurrency.

 

14, three threads with a sequence of three letters abc print cycle, such abcabcabc.

 

15, ThreadLocal used it and for what purposes, what the principle is, use the time to pay attention.

 

16, so that if you implement a secure concurrent list, how would you do.

 

17, which lock-free data structures, principles of what they accomplish.

18, talk about the wait and notify java synchronization mechanism.

19. What CAS mechanism, ABA how to solve the problem.

20, multi-threaded if the thread tangled up in how to do.

21, countdowlatch and cyclicbarrier internal principles and usage, as well as the differences between each other (such as countdownlatch await the method and how to achieve).

22, for AbstractQueuedSynchronizer know about, talk about locking and unlocking process, fairness and the exclusive lock lock any different.

23, using a synchronized static methods and non-static methods of modifying any difference.

24, and briefly ConcurrentLinkedQueue LinkedBlockingQueue usefulness and differences.

25, the cause thread deadlock? How to lift thread deadlock.

26, so multiple threads (possibly different machines), you need to wait for coordination between them in order to complete some work, ask how such coordination program design.

27, used to read and write lock on it, what the principle is, under what scenario with the general.

28, open multiple threads, if the guarantee execution order, which has several implementations, or how to ensure that multiple threads are executing the then get the results.

29, the similarities and differences of the delay queue implementations, and timing wheel DelayQueue algorithm.

 

TCP与HTTP

1, http1.0 and http1.1 What is the difference.

2, TCP three-way handshake and four waving process, why the disconnect to 4 times, if only to shake hands twice, what will appear.

3, the difference between the TIME_WAIT and CLOSE_WAIT.

4, talk about you know several HTTP response, such as 200, 302, 404.

5, when you open a link in browser (such as: http: //www.javastack.cn) when the computer to do what work steps.

6, TCP / IP how to ensure the reliability, talk about the structure of the TCP header.

7, how to avoid the browser cache.

8, how to understand the stateless nature of the HTTP protocol.

9, briefly Http get and post requests and packet format distinction.

10, HTTP which method

11, briefly HTTP request message format.

12, long HTTP connection is what it means

13. What is HTTPS encryption, talk about the entire encryption and decryption process.

14, Http and https three-way handshake What is the difference.

15, what is the block transfer.

16 difference, Session and cookie.

 

Distributed architecture and design

1, with their own java achieve a LRU.

2, how to do a distributed cluster unique serial number.

3, design a spike system for 30 minutes without payment will automatically close the transaction.

4, how to use redis zookeeper and implement distributed lock? What is the difference advantages and disadvantages, what will be the problem, what the scenarios are applicable. (Extension: If you know redlock, talk about his algorithm, where controversy)

5, if someone maliciously create illegal connections, how to solve.

6, principle distributed transactions, advantages and disadvantages, how to use distributed transactions, the difference between 2pc 3pc solve what problems, what problems have not been resolved, how to solve your own projects in a distributed transaction is related to how to deal with .

7. What is the consistency of hash.

8, what is restful, restful talk about your understanding.

9, how to design a good API.

10, how to design build and maintain a long connection of 100w.

11, explain what MESI protocol (cache coherency).

12, to talk about several HASH algorithm, you know, simple can be.

13, what is paxos algorithm, what is zab agreement.

14, an online documentation system, documents can be edited, how to prevent multiple people to edit the same document to be updated.

15, online system suddenly became very slow, how do you find the problem.

16, you usually talk about design patterns used.

17, the principle of Dubbo, and have seen what the source, how the transfer of data, how to achieve clustering, load balancing, service registration and discovery, retry forwarding, fail-fast strategy is like.

18 What a RPC request process Yes. Rpc over themselves to achieve it, you can simply talk about principles. Rpc to solve any problems.

19, uses and significance asynchronous mode.

20, programming himself how to consider some design principles, such as opening and closing the principles and applications at work

21, under the chat server architecture has been involved in the design and drawing, to talk about the problems encountered, how to solve

22, how to monitor the difference between the application server performance, a variety of ways

23, how to design a high concurrent payment scheme, how to design architecture

24, how to achieve load balancing algorithm which can be implemented

25, use of Zookeeper, what is the principle of elections

26, the principle Zookeeper watch mechanism.

26, implementation of the principles underlying Mybatis.

27, consider a program to achieve countDownLatch distributed environment

28, how to prevent back-office systems resubmit request

29, described in detail the process from a service is published to consumption

30, talk about your understanding of service management

31, how to do the interface idempotency

32. How do the current limiting strategy using a token bucket and funnel algorithm scene

33, what is the consistency of the data, how do you understand the data consistency.

34, distributed caller to the service, does not depend on the service provider, then how to deal with the service side hang up, a lot of ineffective waste of resources requested, time only if the service provider is not high throughput of how to do that, if the service hung up, then for a restart, how to do the minimum waste of resources, the realization of what the flow rate half-open mechanism Yes.

35, how to achieve generalization call dubbo, if it is you, how would you do.

36, there will be a remote call timeouts, if do elegant control, JDK comes out mechanism which, how to achieve.

 

algorithm

1,10 one hundred million numbers in which to find a minimum of 10.

2, there are 100 million numbers, of which two are duplicates, find it quickly, time and space to be optimal.

3,2 one hundred million randomly generated integer disorder, to find out the value of intermediate size.

4, does not know to a (potentially large) the length of the input string, a scheme design, heavy duplicate character arrangement.

5, the binary tree traversal.

6, there are 3n + 1 digits, of which the 3n is repeated, only one is not repeated, how to find out.

7, write a string (eg: www.javastack.cn) the inverse function.

8, common sorting algorithm, fast discharge, merge, bubbling. Fast row optimal time complexity, the complexity of the worst. Bubble sort optimization.

9, binary search time complexity advantage.

10, has built a good TreeSet, how to complete the reverse-order.

11, what is the B + tree, B- trees, lists the actual usage scenarios.

12, a singly linked list, delete the penultimate N data.

13,200 ordered arrays, each array element 100 which identify the elements top20.

14, one-way linked list, look for the elements in the middle.

 

Knowledge Database

1, the database isolation level what, what their meaning is, MYSQL default isolation level is what it is.

2. What is the phantom reads.

3, MYSQL which storage engines, their advantages and disadvantages.

4, under high concurrency, how to do safe modify the same rows of data.

5. What are optimistic and pessimistic locking lock is, INNODB standard row-level locking which of two kinds, to explain its meaning.

6. What is the general procedure for SQL optimization, how to see the execution plan, how to understand the meaning of each field.

7, database deadlocks do, give an example of deadlock, mysql how to resolve the deadlock.

8, MYsql of indexing works, what type of index, how to create a reasonable index, index of how to optimize.

9, the difference between the index and aggregate non-clustered index.

10, select for update is what meaning would lock table or row locks or other.

11, why should Btree achieve, how it was split, when to split, why is balanced.

12. What ACID database Yes.

13, a table has nearly ten million data, CRUD slow, how to optimize.

14, Mysql how to optimize the table scan.

15, how to write sql can effectively use the composite index.

16, mysql and exists in the difference.

17, the database auto-increment primary keys possible problems.

18, MVCC meaning, how to achieve.

19, you've done projects in sub-library sub-table encounter yet, how to do, it is useful to middleware, such as sharding jdbc, etc., know what their principles.

20, MYSQL master how to solve the delay.

 

message queue

1, the scene using message queues.

2, retransmission of the message, supplementary policies.

3, how to ensure the orderly message.

4, which used MQ, and other mq compare what advantages and disadvantages, MQ connection is thread safe for you, what your company MQ service architecture.

5, how to ensure that data is not lost MQ system.

6, rabbitmq how to achieve high availability cluster.

7, kafka reasons for the high throughput.

8, and the other difference kafka message queue, from how to achieve the primary synchronization kafka.

9, the use of mq how to achieve eventual consistency.

10, using kafka have not encountered any problems, how to solve.

11, MQ repeated consumption may occur, how to avoid, how to do idempotent.

12, MQ message latency how to deal with, what message you can set the expiration time, the expiration how you usually deal with.

 

Cache

1. What are the common caching strategies, how to do caching (such as redis) and DB where data consistency, what you used in the project caching system, how to design the

2, how to prevent caching and avalanche breakdown.

3, how to update the cache data expired design.

4, redis list of operations related to the structure.

5, Redis data structures are what.

6, Redis is used to pay attention to what, talk about persistence mode, applications and advantages and disadvantages memory settings, cluster, out strategies.

7, the difference redis2 and redis3, redis3 internal communication mechanism.

8, the current redis clusters which games are played, the advantages and disadvantages of each scene.

9, Memcache principle, which fit the data in the cache.

10 difference, redis and memcached memory management.

11, Redis how to solve the problem of concurrent competition, understanding Redis transaction CAS operate it.

12, Redis election algorithm and process is like.

13, the difference between the persistence mechanism redis, aof and the rdb.

14, redis clusters how to synchronize data

15, which optimize the operation of redis know.

16, Reids main principles from the replication mechanism.

17, what Redis threading model yes.

18, consider a program designed to control a local cache buffer size of the overall automatic adaptation.

19, how to treat the use of the cache (local cache, centralized cache), outlining the local cache and centralized caching and the advantages and disadvantages.

20, the local cache precautions when used concurrently.

 

search for

1, elasticsearch to know how much to talk about your company es cluster architecture, the index data size, number of fragments, as well as some tuning means

2. What elasticsearch inverted index yes.

3, elasticsearch index data more how to do, how to tune the deployment.

4, elasticsearch is how to achieve master election

5, a detailed description of what Elasticsearch document indexing process

6, detailed description about the search process Elasticsearch

7, Elasticsearch at deployment, optimization methods which have set for Linux?

8. What lucence internal structure Yes. 

Guess you like

Origin www.cnblogs.com/hericwan/p/12635606.html
Recommended