Today I went to a company, the name of the Atlas World
Cut the crap and say:
1. Customize how a table field is implemented
The first time I heard the question, I said it's easy to store all the tables and all the columns in the database table structure, and use the table to manage the tables and fields created by the user.
After I answered this, the opposite is not very satisfied, said: If the field more how to do. And I'm doing this. Each query must first query to the required table, in the query to the required columns, in order to execute the final query. It's not good to do that. I have nothing to do, I used to think it was a good way. How about that.
There are several ways to do this online:
1. Dynamically Add property fields.
2. Reserve the field first and then use it again.
3. Save using XML fields.
4. JSON format save.
5. property Field Row Store "recommended mode"
This blog is well written: http://blog.csdn.net/kk185800961/article/details/53208667
2. Similar to the DOBBO service framework, how to implement multi-node session sharing
Similar to this problem landlord really did not really solve, I first answer using filter to achieve, he asked me if I have any other ideas, I said that can use MQ message push to different nodes, to the session alone set an ID as a unique indicator "obviously not."
The answer on the net:
1. Use the database to sync session[feeling this is not a good method, do not repeat the
2. Use cookies to synchronize session
Session is the file situation stored on the server side, the cookie is the file situation exists in the client, how to achieve synchronization.
The method is very simple, that is, the user access page generated by the session into the cookie, is a cookie as a transit point.
You access Web Server A, generates a session and puts it in a cookie, and you access is assigned to Web Server B.
At this point, Web Server B first determines whether the server has this session
If not, in going to look at the client cookie inside there's no this session
If there is no, the session really does not exist, if the cookie inside, the cookie inside the Sessoin synchronization to the Web Server B, so you can achieve synchronization of the session.
Description: This method to achieve simple, convenient, and will not increase the burden of the database, but if the client to ban the cookie, then the session will not be synchronized, which will bring loss to the site;
Cookies are not secure, but they can be forged even though they are already added.
3. Use Memcache Synchronous session "recommend"
Memcache can combine the memory of a multi-node server in the Web to form a pool of memory so that other servers can be used regardless of which server's session is generated.
Disadvantage: Memcache divides memory into different storage blocks, and is different in size and fixed, resulting in memory leaks if there is insufficient storage
3. Multi-node transaction "Distributed Transaction" If transaction consistency is implemented
The question was not answered ...
There are two characteristics of this transaction: 1. Final consistency 2. Process consistency
The final consistency is well understood, that is, the final transaction remains consistent. (use MQ to push transaction messages on line)
Process consistency: Some of the transactions in the execution of some of the columns are consistent (this has not been met and there is no good idea.) For the sake of sharing)
4.js traversal of how HTML nodes are traversed
I said first from top to bottom, and then he said, "What's the principle of getting the node by ID," I said: "Look at the beginning of the HTML document, find it, return it, and do not continue looking down." And then he wrote me an example of what node I was getting in accordance with Id=one.
<div>
<div id= "One" ></div>
</div>
<div id= "One" >
<div>
What are the optimizations for 5.SQL statements:
I said some simple things first:
1. Try not to use *
2. Create an appropriate index for the column
3. Use stored procedures or views to store more complex SQL
4.sql using placeholders to prevent SQL injection (he said Alibaba's database middleware can solve this problem, as if it were the Cobar)
The interviewer thought it was too easy and asked if I had any other optimizations ... However
His tip:
If there is an age in a table, it is better to write >age when the query is >=age (at the time of the mask), because >= less than > a traverse "God"
Online:
http://www.jb51.net/article/39221.htm here MySQL gives a lot of optimization solutions
Answer: Get to one node. Ask me why not first get the outer div, I said HTML is recursive traversal of the "not to say wrong, feeling is" the main face of the question is probably the few, then there is no then, the landlord will continue to share tomorrow. Work at the end of the year is not easy to find, shared learning