Ignore other questions and go directly to the technical interview
What kind of Java GC is configured in your company server?
Java GC is divided into four types, namely
- -XX:+USESERIALGC Serial garbage collector
- -XX:+USEPARALLELGC Parallel garbage collector
- -XX:+USECONCMARKSWEEPGC concurrent Tag Scan garbage collector
- -XX:+USEG1GC G1 garbage collector
Select the answer and explain why.
MySQL has a variety of engines, InnoDB support transactions? What is the principle?
MySQL has the following engine: MyISAM, InnoDB (default engine after 5.5), MERGE, MEMORY (HEAP), BDB (BerkeleyDB), EXAMPLE, Federated, ARCHIVE, CSV, Blackhole.
InnoDB is an engine that supports transactions
The principle is how to implement a transaction, first leading to four isolation levels of the transaction
- READ UNCOMMITTED not submitted
A change in a transaction that has been able to read by other transactions before the thing commits. Dirty Reads (Dirty read).
- Read Committed reading Commit
When a transaction starts, it can only read results that have been committed by other transactions.
- REPEATABLE Read Repeatable reads
In the same transaction, the results of multiple reads are the same.
But you can't avoid phantom reading. Phantom read: When a transaction reads a record in a range, another transaction inserts a new record within that scope. When the previous transaction reads the range again, a magic line (Phantom row) is generated.
MysqlUnlike other databases, Phantom reads are avoided at this isolation level.
- Serializable can be serialized
Forced transaction serialization, completely avoid the above mentioned dirty read, non-repeatable read, phantom reading problems.
Followed by ACID
A: atomicity (atomicity)
C: Consistency (consistency)
I: Isolation Line (Isolation)
D: Persistence (Durability)
- But how does a business guarantee acid?
The implementation of the transaction is done through the transaction log. Redo log, undo log,
A:innodb uses the group commit method to ensure atomicity.
C: Consistency is implemented by the undo log. Undo logs In addition to rollback, Undo implements MVCC, reads a row of records, discovers transaction locks, recovers to previous versions with Undo, and implements non-lock reads.
I: Isolation line is actually implemented by lock, InnoDB has a row lock, table lock
D: Persistence is the log
Summarize
1. Redo log (transaction log) guarantees the atomicity and persistence of transactions (physical log)
2, undo log to ensure the consistency of the transaction, InnoDB MVCC is also used with the undo log (logical log).
3, redo log with checkpoint, for efficient recovery of data.
4. The physical log records the details of the modified page, and the logical log records the operation statement. Physical log recovery is faster than logical logs.
Thank you: http://blog.csdn.net/tangkund3218/article/details/47904021
MySQL Transaction JAVAGC interview