Seckill System-Introduction

Spike system

 

The seckill system is actually a system for inventory. When the user successfully kills the product, the operation of our system is to reduce the inventory and record the user's purchase details. The user's purchase details include recording who made the purchase, when the purchase was successful, and payment information. For inventory reduction operations, the following two issues need to be considered:

(1) If the user successfully kills the product, we record the purchase details, but do not reduce the inventory. It will lead to oversold products.

(2) The inventory is reduced but the user's purchase details are not recorded, resulting in less sales of goods.

For the above two problems, it can be handled through MySQL's built-in transaction mechanism, which can accurately help us complete the process of reducing inventory and recording user purchase details.

For the seckill system, we just implement some functions of seckill:

(1) Exposure of the seckill interface.

(2) Perform a spike operation.

(3) Related queries, such as list queries, details page queries.

The seckill system includes the design of three modules, the design of the DAO layer, the service layer and the web layer. In addition, considering the high concurrency of the system, the high concurrency processing of the system is designed. Before the system design, in order to better understand the development process of the system, the related technologies are described.

6.3.1 Introduction of related technologies

MySQL:

Create application and row-level locks for related tables, transactions.

DAO:

A data access object is basically an object or interface that provides access to the underlying database or any other persistent storage.

MyBatis:

MyBATIS is a first-class persistence framework that supports custom SQL, stored procedures, and advanced mappings. MybATIS eliminates almost all JDBC code and manually setting parameters and retrieving results. MyBatis can use simple XML or annotations to configure and map primitives, map interfaces and java POJOs (Plain Old java objects) to database records.

SLF4J

Java's Simple Logging Facade (is slf4j) as a simple facade or abstraction of various logging frameworks (eg java.util.logging, logback, log4j) allows the user to plug in the desired deployment time logging framework.

Login item

Logback:

The purpose of Backtracking is to pick up where Log4J left off as a successor to the popular Log4J project.

The architecture of log fallback is general enough to be applied in different situations. Currently, backtracking is divided into three modules: backtracking core, backtracking classic, and backtracking access.

Backtracking to the core module lays the groundwork for the other two modules. LogLogic Classic modules can be assimilated into a significantly improved version of Log4J. Additionally, Backtracking Classic itself implements the SLF4J API so that you can easily switch back and forth between Backtracking and other logging frameworks, such as Log4J or JavaUTIL Logging (JUL).

The retrospective access module integrates with servlet containers (such as Tomcat and JETTY) to provide HTTP access logging capabilities. Note that you can easily build your own modules on top of LogCub core.

C3P0:

C3P0 is an easy-to-use library that enhances traditional JDBC drivers "enterprise-ready" by using features defined by the JDBC3 specification and optional extensions to JDBC2.

Spring framework:

The Spring Framework is an application framework and inversion of control container for the Java platform. The core functionality of the framework can be used in any java application, but there are also extensions for building web applications on top of the java EE platform.

Spring MVC framework:

The Spring WebMVC framework provides a Model View Controller (MVC) architecture and ready-made components that can be used to develop flexible and loosely coupled web applications. The MVC pattern leads to separation of different aspects of the application (input logic, business logic and UI logic) while providing loose coupling between these elements.

The model encapsulates application data, which in general will consist of POJOs.

The view is responsible for rendering the model data, and in general, it produces HTML output that the client browser can interpret.

The controller is responsible for handling user requests and building the appropriate model and passing it to the view for rendering.

taglib:

The TAGLIB directive declares that your JSP page uses a set of custom tags, identifies the location of the library, and provides a way to identify custom tags in the JSP page.

JSTL :

The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags that encapsulates core functionality common to many JSP applications. JSTL supports common structural tasks such as iteration and conditional statements, tags for manipulating XML documents, internationalization tags, and SQL tags.

protostuff:

Serialization library with built-in support for backward compatibility (schema evolution) and validation.

MySQL:

Create related tables,the applications of transaction and row-level lock.

DAO :

The Data Access Object is basically an object or an interface that provides access to an underlying database or any other persistence storage.

MyBatis:

MyBatis is a first class persistence framework with support for custom SQL, stored procedures and advanced mappings. MyBatis eliminates almost all of the JDBC code and manual setting of parameters and retrieval of results. MyBatis can use simple XML or Annotations for configuration and map primitives, Map interfaces and Java POJOs (Plain Old Java Objects) to database records.

SLF4J _

The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logging frameworks (e.g. java.util.logging, logback, log4j) allowing the end user to plug in the desired logging framework at deployment time.

Logback Project

Logback

Logback is intended as a successor to the popular log4j project, picking up where log4j leaves off.

Logback's architecture is sufficiently generic so as to apply under different circumstances. At present time, logback is divided into three modules, logback-core, logback-classic and logback-access.

The logback-core module lays the groundwork for the other two modules. The logback-classic module can be assimilated to a significantly improved version of log4j. Moreover, logback-classic natively implements the SLF4J API so that you can readily switch back and forth between logback and other logging frameworks such as log4j or java.util.logging (JUL).

The logback-access module integrates with Servlet containers, such as Tomcat and Jetty, to provide HTTP-access log functionality. Note that you could easily build your own module on top of logback-core.

c3p0

c3p0 is an easy-to-use library for making traditional JDBC drivers "enterprise-ready" by augmenting them with functionality defined by the jdbc3 spec and the optional extensions to jdbc2.

Spring framework

The Spring Framework is an application frameworkand inversion of control container for the Java platform. The framework's core features can be used by any Java application, but there are extensions for building web applications on top of the Java EE platform.

Spring - MVC Framework

The Spring Web MVC framework provides Model-View-Controller (MVC) architecture and ready components that can be used to develop flexible and loosely coupled web applications. The MVC pattern results in separating the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements.

The Model encapsulates the application data and in general they will consist of POJO.

The View is responsible for rendering the model data and in general it generates HTML output that the client's browser can interpret.

The Controller is responsible for processing user requests and building an appropriate model and passes it to the view for rendering.

taglib:

The taglib directive declares that your JSP page uses a set of custom tags, identifies the location of the library, and provides a means for identifying the custom tags in your JSP page.

JSTL

The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags which encapsulates the core functionality common to many JSP applications. JSTL has support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization tags, and SQL tags.

protostuff

A serialization library with built-in support for forward-backward compatibility (schema evolution) and validation.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325257051&siteId=291194637