java interview questions - see where that record

Hash collision

  If two different elements, the actual storage address obtained by the same hash function how to do? In other words, when we were on an element hashing get a memory address, and then want to insert, and found other elements has been occupied, in fact, this is the so-called hash collision, also called hash collision.

  Critical to the design of the hash function, a good hash function will ensure simple and uniform distribution of hash address as possible. But we need to be clear that the array is a continuous fixed-length memory space, in good hash function can not guarantee that memory address get decisions do not conflict.

  Solutions for a variety of hash collisions: Address Development Act (conflict, continue to look at a memory address unoccupied) and then hash function method, chain address law, and HashMap that is using a chain address law, also + list is an array of ways.

  + HashMap from the list consisting of an array, the array is subject HashMap, the list is in order to resolve hash collision exists;

 

redis persistence mechanism

  RDB: Redis is the default persistence scheme, within the specified time interval, to perform a specified number of write operations, it will be written into the data memory to disk, to generate a dump.rdb file under the specified target. redis reboot will restore the data files by loading dump.rdb;  

  AOF: Redis is not turned on by default, it appears to make up for the lack of RDB (data inconsistency), so it takes the form of a log to record each write operation, and append to the file. redis will restart from front to back to perform a data recovery has been completed based on the contents of the log file will be written instruction;

 

Spring AOP 

  AOP can be independent of those operations, but a logic (transaction log, permissions) service module jointly called packaged to facilitate less code system is repeated, reducing the coupling between modules, and facilitates future scalability and maintainability.

  Spring AOP is a dynamic proxy, if the proxy object implements an interface, then Spring AOP will use JDK dynamic proxy to create a proxy object, but the object does not implement an interface, you can not use JDK dynamic proxies in favor based CGlib dynamic proxy generates a proxy object is a subclass as a proxy.

 

Database isolation level

  Database transaction isolation level there are four, from low to high was Read uncommitted (read uncommitted), Read committed (read committed), Repeatable read (repeatable read), Serializable (serialized) The four isolation levels can be solved one by one dirty reads, non-repeatable read, phantom read these types of problems.

 

 Difference Mysql row locks and table locks

  

 

   As shown above, the lock granularity may be divided into two categories

  Table lock: spending big, fast locking, deadlock will not occur, large locking strength, high probability of lock conflicts, the low degree of concurrency.

  Line Lock: Small overhead, locking slow, there will be a deadlock, lock strength, low probability of lock conflicts, high concurrency read.

 

How does your system supports high concurrency?

  1. System clustered deployment

  2. The database sub-library separate read and write sub-table +

  3. Cache Cluster introduced

  4. The introduction of the cluster MQ messaging middleware

 

Guess you like

Origin www.cnblogs.com/SuperManer/p/11693123.html