What is Solrcloud
Solrcloud is a distributed search solution provided by SOLR, when you need large-scale, fault-tolerant, distributed indexing and retrieval capabilities when using Solrcloud. When the index data of a system is less than the need to use Solrcloud, when the index is very large, the search request concurrency is very high, then need to use Solrcloud to meet these requirements.
Solrcloud is a distributed search scheme based on SOLR and zookeeper, and its main idea is to use zookeeper as the configuration information Center for the cluster.
It has several features:
1) Centralized configuration information
2) Automatic fault tolerance
3) near real-time search
4) Automatic load balancing when querying
How does SOLR set the top (score) for search results?
You can set the boost value of a field in a document, the higher the boost value, the higher the relevance score, and the higher the ranking. This method can improve the ranking of hot products or promotional items.
SPRINGMVC Global Exception Handling
The whole system has only one,
How to use:
1) need to implement an interface
Handlerexceptionresolver
2) need to be configured in SPRINGMVC.
Processing logic:
Captures exceptions that occur throughout the system.
1. Exception Write log file
2. Notify the developer promptly. e-mail, SMS.
Show an error page, for example: Your network failure, please try again.
Web page static
Benefits: 1. Facilitates SEO 2. Increase access Speed 3 Resolve high concurrency
Timing of static file generation: Generate static Web pages when adding and editing items in the background
1. MQ sends messages
2, receive the message, generate a static page
3, Nginx access to static pages.
What is an SSO system
Single Sign-on is a multi-application system in which users can access all trusted applications with only one login.
Process of Login:
1, the login page to submit the user name password.
2. After successful login, token is generated. Tokens are equivalent to the original Jsessionid, strings, and can use UUID.
3, save the user information to Redis. The key is Token,value the Tbuser object is converted to JSON.
4. Save session information using string type. You can use "prefix: Token" as key
5. Set the expiration time of key. Simulates the expiration time of the session. Generally half an hour.
6. Write the token into a cookie.
How to tell if you are logged in
1. Taking tokens from cookies
2. No login is not taken
3. Take token to check if token expires in Redis
4. If expired, the login status
5. No expiration, login status
To achieve the data synchronization of car purchase goods
1, require users to log in.
2. Save the list of shopping cart items to the database. It is recommended to use Redis.
3. Key: User id,value: List of goods for purchase. It is recommended to use Hash,hash's field: Commodity id,value: Product information.
4. Write a cookie in case the user is not logged in. When the user logs in and accesses the shopping cart list,
A) Synchronize the data in the cookie to Redis.
b) Delete the data in the cookie
c) When displaying the shopping cart list, use Redis as the standard.
D) If there is data in the data cookie in Redis, data merging is required. Add a new product to different items by adding the same quantity.
5. If the user is logged in, the display cart list will be based on Redis. If you are not logged in, the cookie will prevail.
Browser cross-domain issues
Cross-domain refers to a resource that requests another domain name from a Web page of a domain name. Browsers do not allow requests from different sources for security reasons
JSONP Resolving Ajax Cross-domain issues:
Jsonp is a common method for server-to-client cross-origin communication. The biggest feature is simple to use, old browsers all support, server transformation is very small.
The basic idea is that Web pages request JSON data from the server by adding a <script> element that is not subject to the same-origin policy; After the server receives the request, it returns the data in a callback function with the specified name.
Storage problems of massive data
Today, with the development of the Internet, the magnitude of the data is exponential, from GB to TB to PB. The operation of the data is also more difficult, the traditional relational database can not meet the needs of fast query and insert data. At this time, the advent of NoSQL temporarily solved the crisis. It gains performance by reducing the security of the data, reducing support for transactions, and reducing support for complex queries.
However, in some cases nosql compromises are not enough to satisfy the usage scenario, for example, some usage scenarios are absolutely business and security indicators. NoSQL is certainly not sufficient at this time, so it is still necessary to use a relational database. What if you use a relational database to solve massive storage problems? At this point, you need to do a database cluster, in order to improve query performance to spread the data of a database into a different database storage.
Java e-Commerce project surface question (II.)