Simulation training system for business administration major

By adopting hierarchical architecture, microservice architecture and concurrent control and transaction processing modules in the business management simulation system, the problems of multi-user collaboration and transaction consistency are solved, and the stability and reliability of the system are achieved.

CN119557059APending Publication Date: 2025-03-04BEIJING JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411629130.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

The existing business management simulation system has challenges in multi-user collaboration and transaction consistency, and it is difficult to ensure the correct and consistent storage of data when multi-user operations.

Method used

Adopt a hierarchical architecture and microservice architecture, combining concurrent control and transaction processing modules, and using database transactions and optimistic lock/pessimistic locking strategies to ensure the atomicity, consistency, isolation and persistence of multi-user operations.

Benefits of technology

It effectively solves the problems of multi-user collaboration and transaction consistency, improves the system's concurrent processing capabilities and data consistency, and ensures the stability and reliability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119557059A_ABST
    Figure CN119557059A_ABST
Patent Text Reader

Abstract

The invention discloses a business administration major simulation training system comprising a layered architecture comprising a front end, a rear end and a database; the micro-service architecture is used for splitting different functions into independent services; the concurrency control and transaction processing module is used for ensuring atomicity, consistency, isolation and durability of multi-user operation by using database transactions; the real-time and asynchronous processing module is used for establishing a real-time communication channel; the asynchronous task processing module is used for designing a task which runs for a long time into an asynchronous task and decoupling initiation and execution of the task by using a message queue; the user identity verification and authority control module is used for user identity verification and authority control; and the performance optimization and load balancing module is used for using a cache mechanism, reducing the burden of the database, improving the data access speed and deploying a load balancer so as to distribute user requests and ensure that the system has the horizontal expansion capability. According to the invention, the problem of multi-user collaboration and transaction consistency of the business administration major simulation training system is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of business administration software, and in particular to a business administration professional simulation training system. Background Art

[0002] The business administration simulation system is a system that trains and develops business administration-related skills through simulation. The system is usually designed for education and training environments to help students, professionals or corporate employees learn and practice knowledge and skills related to business administration. Existing business administration simulation systems usually have multiple users performing various operations at the same time, such as data entry, report generation, etc. How to ensure that the data can be correctly and consistently saved and updated when multiple users operate the system at the same time involves multi-user collaboration issues, as well as how to ensure the consistency of transactions and prevent the system from being in an inconsistent state due to the failure of a certain operation step. This is also a problem that needs to be paid attention to. Summary of the invention

[0003] In order to solve the problem of multi-user collaboration and transaction consistency in the background technology, the present invention provides a business administration professional simulation training system.

[0004] The technical solution adopted by the present invention is as follows:

[0005] Business administration professional simulation training system, including:

[0006] Layered architecture, including front-end, back-end and database;

[0007] Microservice architecture, which is used to split different functions into independent services;

[0008] Concurrency control and transaction processing module, which uses database transactions to ensure the atomicity, consistency, isolation and durability of multi-user operations, and adopts optimistic locking and / or pessimistic locking strategies to address concurrency issues;

[0009] Real-time and asynchronous processing module, used to establish real-time communication channels to notify users when data changes;

[0010] Asynchronous task processing module, which designs long-running tasks as asynchronous tasks and uses message queues to decouple task initiation and execution;

[0011] User authentication and permission control module, which is used for user authentication and permission control. JWT is used for user authentication and fine-grained permission control is implemented to ensure that users can only access data and functions for which they have permission.

[0012] The performance optimization and load balancing module is used to use the caching mechanism to reduce the database burden, improve data access speed, and deploy a load balancer to distribute user requests to ensure that the system has horizontal scalability.

[0013] Further: the front-end uses the React framework to build the front-end application, implement the user interface, and split different functions into independent React components to improve the maintainability and reusability of the code. In the React front-end, HTTP requests are initiated through Fetch or Axios tools to communicate with the back-end, process asynchronous operations, and ensure timely updates of the user interface;

[0014] The backend uses Node.js and Express frameworks to build backend services, encapsulating business logic and database access functions into different service modules to achieve loose coupling. In the Express backend, API routing is set, RESTful APIs are defined for front-end calls, middleware is used to ensure the legitimacy of requests, and identity authentication and authorization are implemented;

[0015] The database uses PostgreSQL as a database management system to store persistent data of the system;

[0016] The microservice architecture splits different business logics into independent microservices according to system functions, and uses message queues for communication between microservices.

[0017] Further: the concurrency control and transaction processing module includes:

[0018] Define a set of operations to be performed in the database as a transaction, and use the ACID characteristics provided by the database to ensure the correct execution of the transaction;

[0019] Among them, the pessimistic locking strategy includes: using the row-level lock mechanism provided by the database before key operations to prevent other transactions from modifying the same row of data; setting the database transaction isolation level to ensure the isolation between transactions during concurrent execution;

[0020] Among them, the optimistic locking strategy includes: introducing a version field in the data table to record the version number of the data, and comparing the version number when updating to ensure that the operation is based on the latest version of the data;

[0021] Monitor errors in transactions, such as database operation exceptions or business logic errors, trigger the transaction rollback mechanism, undo all previously executed database operations, and maintain database consistency.

[0022] Further: the real-time and asynchronous processing module includes:

[0023] Use Node.js and Express framework on the back end, integrate the WebSocket library, and use the WebSocket API on the front end to establish a WebSocket connection with the back end.

[0024] Further: the asynchronous task processing module includes:

[0025] Use an asynchronous framework to design long-running tasks as asynchronous tasks;

[0026] Install and configure the message queue to ensure that the system can establish a connection with the message queue;

[0027] Decouple the initiation and execution of tasks. On the side that initiates the task, the task information is sent to the message queue. On the side that executes the task, the task information in the message queue is listened to, the task is obtained and executed.

[0028] Further: the message queue includes:

[0029] Configure a cluster in the message queue, including several nodes distributed on different physical servers or virtual machines to ensure isolation between nodes;

[0030] Set up interconnection and synchronization between nodes to ensure that nodes in the cluster can sense each other and synchronize data in the message queue;

[0031] Monitor node status to detect node failures. When a node fails, the system triggers a failover and transfers the workload to other nodes that are operating normally.

[0032] Use load balancing mechanism to ensure that the requests in the message queue can be evenly distributed to each node in the cluster;

[0033] Set up a redundancy mechanism to ensure that if a node fails, other nodes can still provide services;

[0034] According to the system load, set up automatic expansion and reduction mechanisms to ensure that the system can dynamically adjust the number of nodes according to demand to adapt to changing workloads.

[0035] Further: the decoupling of task initiation and execution includes:

[0036] Determine the format of task information, including task type, parameters, and executor ID;

[0037] Create a task queue to store task information to be executed;

[0038] When a task needs to be initiated, the task information is added to the task queue;

[0039] The task executor periodically polls the task queue to check whether there are tasks to be executed;

[0040] The task executor takes the task information from the task queue, parses the task type and parameters, and executes the corresponding task logic;

[0041] After the execution is completed, the task status is updated or the execution result is returned to the task initiator as needed.

[0042] Further: In the user identity authentication and permission control module, using JWT for user identity authentication includes:

[0043] Integrate the JWT library into the system, configure the JWT key and expiration time parameters to ensure security and a reasonable validity period;

[0044] The user provides identity information to log in;

[0045] The backend verifies the user's identity. If the verification is successful, a JWT is generated and returned to the frontend.

[0046] Generate JWT using the key against the user identity information on the backend;

[0047] Send the generated JWT to the front end in a secure way;

[0048] The front end adds JWT to the Authorization header of the request every time it makes a request;

[0049] After receiving the request, the backend parses the JWT and verifies its legitimacy and validity period.

[0050] Further: In the user identity authentication and permission control module, fine-grained permission control is implemented to ensure that users can only access data and functions for which they have permission, including:

[0051] Define fine-grained permission rules in the system, including data access permissions and functional operation permissions;

[0052] Perform permission checks on each protected resource or operation point to ensure that the user has the permission to perform the operation;

[0053] If the permission check fails, the corresponding error code or message is returned to ensure that unauthorized users cannot access protected resources.

[0054] Further: the performance optimization and load balancing module includes:

[0055] Deploy a cache server as the system's cache storage and configure cache policies, including cache expiration time and data elimination policies;

[0056] Before accessing the database, check whether the requested data exists in the cache;

[0057] If the data exists in the cache, it is directly returned to the front end, skipping the subsequent database query;

[0058] If the data does not exist in the cache, perform a normal database query and store the result in the cache;

[0059] Deploy a load balancer to distribute user requests to the backend;

[0060] Add multiple application servers behind the load balancer to achieve horizontal expansion of the system.

[0061] Compared with the prior art, the present invention has the following technical advances:

[0062] The present invention adopts a distributed transaction processing mechanism, and ensures the atomicity, consistency, isolation and persistence of multi-user operations through transaction management services. This mechanism can effectively handle complex business operations across multiple services or modules, and ensure the stability of the system during transaction processing. The present invention introduces real-time and asynchronous processing mechanisms, and realizes real-time data push through WebSocket, so that users can obtain system changes in a timely manner, improve the real-time performance of the system, and allow users to be closer to the actual working environment in simulation training. The present invention uses optimistic locking or pessimistic locking strategies to handle multi-user collaborative operations, ensure data consistency during concurrent access, can effectively prevent data conflicts and errors, and improve the reliability of the system.

[0063] The present invention also adopts a layered architecture and a microservice architecture to split the system into independent services, which helps to improve the maintainability and scalability of the system. Each service is responsible for a specific business function, which reduces the coupling between services and makes the system more elastic and flexible. The deadlock detection and unlocking mechanism is introduced, and the potential deadlock problem is effectively dealt with through the timeout mechanism and the automatic deadlock release strategy, which improves the robustness of the system and ensures that the system will not stagnate due to deadlock in complex operations.

[0064] In general, the advantages of the present invention in multi-user collaboration and transaction processing issues are mainly reflected in improving the system's concurrent processing capabilities, ensuring data consistency, realizing real-time data updates, and improving the maintainability and scalability of the system through layered architecture and microservice architecture. These advantages make the designed system more suitable for the simulation training environment of business administration majors. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.

[0066] In the attached picture:

[0067] Figure 1 is a system structure diagram of the present invention;

[0068] Figure 2 A flowchart of the rollback victim transaction evaluation of the present invention;

[0069] Figure 3 A flow chart for defining transaction boundaries of the present invention. DETAILED DESCRIPTION

[0070] The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.

[0071] Example 1

[0072] like Figure 1 As shown, the present invention discloses a business administration professional simulation training system to solve the problem of multi-user collaboration and transaction consistency, including:

[0073] Layered architecture, including front-end, back-end and database;

[0074] Microservice architecture, which is used to split different functions into independent services;

[0075] The concurrency control and transaction processing module uses database transactions (ACID characteristics) to ensure the atomicity, consistency, isolation, and durability of multi-user operations, and adopts optimistic locking and / or pessimistic locking strategies to address concurrency issues;

[0076] Real-time and asynchronous processing module, used to establish real-time communication channels to notify users when data changes;

[0077] Asynchronous task processing module, which designs long-running tasks as asynchronous tasks and uses message queues to decouple task initiation and execution;

[0078] User authentication and permission control module, which is used for user authentication and permission control. JWT is used for user authentication and fine-grained permission control is implemented to ensure that users can only access data and functions for which they have permission.

[0079] The performance optimization and load balancing module is used to use the caching mechanism to reduce the database burden, improve data access speed, and deploy a load balancer to distribute user requests to ensure that the system has horizontal scalability.

[0080] The present invention can solve the problems of multi-user collaboration and transaction processing, ensure the consistency and stability of system data, handle real-time and asynchronous processing problems at the same time, improve user experience and system performance, and provide a reliable simulation training environment for business administration majors.

[0081] Example 2

[0082] Specifically, the layered architecture includes:

[0083] The front-end uses the React framework to build the front-end application and implement the user interface. It adopts component design and splits different functions into independent React components to improve the maintainability and reusability of the code. In this embodiment, the front-end uses the Node.js package management tool npm to install React and related dependencies, and uses the CreateReactApp tool to initialize the project structure and establish basic files and folders.

[0084] The backend uses Node.js and Express frameworks to build backend services, encapsulating business logic, database access and other functions into different service modules to achieve loose coupling. In this embodiment, npm is used to install the Express framework to create the basic structure of the backend application.

[0085] Database: Use PostgreSQL as the database management system to store the persistent data of the system. Install the PostgreSQL database on the server and ensure that the appropriate user permissions and database are set, create database tables and indexes, and design the table structure to meet system requirements. In this example, the database migration tool Knex.js is used to manage the database version.

[0086] Microservices Architecture:

[0087] According to the system functions, different business logics are split into independent microservices. For example, in this embodiment, user management services, order management services, etc. can be split. In this embodiment, the microservice architecture introduces an API gateway (Kong is used in this embodiment) as the entrance of the microservice, which is responsible for the routing and authentication of requests, improving the security and maintainability of the system. In this embodiment, message queues are used for communication between microservices to ensure that they can work together.

[0088] In the Express backend, set up API routing, define RESTful API for the front-end to call, use middleware to ensure the legitimacy of the request, implement authentication and authorization, and in the React front-end, initiate HTTP requests through the Fetch tool to communicate with the Express backend.

[0089] In this implementation, front-end and back-end joint debugging and testing can be performed:

[0090] Configure Cross-Origin Resource Sharing (CORS) in Express to allow the front-end to access the back-end API, write and execute unit tests for the front-end and back-end to ensure that each component of the system operates as expected.

[0091] And performance optimization:

[0092] Use React's virtual DOM technology to improve front-end performance, and use Webpack tools for code splitting and compression;

[0093] Use the asynchronous and non-blocking features of Node.js to ensure performance in high-concurrency scenarios, and introduce a cache mechanism to reduce the burden on the database;

[0094] Use tools such as Docker for containerization to simplify the deployment process and integrate monitoring systems to monitor system performance, errors, and user behavior;

[0095] Use log tools to record system operation logs to facilitate troubleshooting.

[0096] In summary, by adopting a layered architecture and microservice architecture, the system can be modularized and scalable, and different functional modules can be developed and deployed independently. This design makes the system easier to maintain, expand, and upgrade, while better adapting to the needs of multi-user collaboration and asynchronous processing.

[0097] Specifically, the concurrency control and transaction processing modules include:

[0098] Define a set of operations that need to be performed as a transaction in the database to ensure that all operations succeed or fail, and use the ACID characteristics (atomicity, consistency, isolation, and persistence) provided by the database to ensure the correct execution of transactions.

[0099] When solving concurrency problems, pessimistic locking strategies and optimistic locking strategies are introduced. The pessimistic locking strategy includes:

[0100] Before key operations, the row-level lock mechanism provided by the database is used to prevent other transactions from modifying the same row of data, that is, row-level lock; the database transaction isolation level is set. In this embodiment, Serializable is used to ensure isolation between transactions during concurrent execution, that is, transaction isolation level.

[0101] Among them, the optimistic locking strategies include:

[0102] A version field is introduced into the data table to record the version number of the data. When updating, the version number is compared to ensure that the operation is based on the latest version of the data. In this embodiment, the compare and swap (CAS) optimistic locking algorithm is used to update the data in an atomic manner.

[0103] However, there is a situation where transactions wait for resources in a loop, which causes all transactions to be unable to continue to execute, that is, deadlock occurs. To solve the deadlock, this embodiment also includes:

[0104] Maintain a transaction waiting graph, where nodes represent transactions and directed edges represent waiting relationships. If transaction T1 waits for transaction T2, there is an edge from T1 to T2.

[0105] Perform periodic cycle detection on the transaction waiting graph and use the depth-first search (DFS) algorithm to detect whether there is a cycle in the graph;

[0106] When a cycle is detected in the graph, determine whether it is a deadlock;

[0107] If it is a deadlock, record the deadlock transaction and enter the unlocking phase;

[0108] Select a deadlock transaction as the victim and terminate the transaction to resolve the deadlock;

[0109] Roll back all operations of the victim transaction and release the lock resources it holds;

[0110] Notify other transactions about the rollback of the victim transaction so that they can continue execution.

[0111] In this embodiment, the deadlock detection and unlocking algorithm is executed periodically and can be scheduled regularly to timely discover and solve deadlock problems. Before the transaction is executed, the execution order of the transaction can be adjusted according to the historical transaction execution status and resource contention status to reduce the probability of deadlock.

[0112] In the above description, choosing an appropriate victim is a key issue in solving deadlock. Its basic goal is to choose the victim with the least impact on the system. Therefore, Figure 2 As shown, this embodiment also includes:

[0113] Step 1.1 Transaction Priority P:

[0114] Each transaction is assigned a priority to reflect its importance to the system. In this embodiment, rules are formulated according to business requirements, such as the urgency and importance of the transaction.

[0115] Step 1.2 Waiting time W:

[0116] Calculate the time each transaction waits for resources. The longer the waiting time, the more urgent the transaction.

[0117] Step 1.3 Execution progress E:

[0118] Estimate the execution progress of the transaction. The higher the execution progress, the closer the transaction is to completion, and choosing it as the victim may have less impact on the system.

[0119] Step 1.4 Considering the transaction priority, waiting time and execution progress, use the comprehensive evaluation formula:

[0120]

[0121] Among them, P is the transaction priority, W is the waiting time, and W max is the maximum value of the waiting time, E is the execution progress, w1, w2, w3 are the weights of each indicator, satisfying w1+w2+w3=1.

[0122] Step 1.5: Based on the comprehensive evaluation score, select the transaction with the lowest score as the victim. The lower the score, the smaller the impact on the system.

[0123] Through the above steps, the system can make a comprehensive assessment based on the transaction priority, waiting time and execution progress, and select the victim with the least impact on the system, thereby reducing the cost of deadlock resolution and reducing the negative impact on system performance and user experience.

[0124] Monitor errors in transactions, such as database operation exceptions or business logic errors. If an error occurs, the transaction rollback mechanism is triggered to undo all previously executed database operations to maintain database consistency. However, when a transaction error occurs, the previous operation needs to be rolled back, which may cause system performance to degrade. Therefore, it is necessary to carefully design transaction boundaries and minimize the scope of transactions to reduce the cost of rollback. Figure 3 As shown, this embodiment also includes:

[0125] Step 2.1 Monitor transaction execution: Monitor the execution process of transactions in real time, including the operations performed by each transaction, execution time, data involved, etc.

[0126] Step 2.2 Transaction execution indicators: Record the execution indicators of each transaction, including transaction execution time, number of operations, amount of data involved, etc.

[0127] Step 2.3 Rollback cost calculation: For each transaction, calculate its rollback cost, considering the time and number of operations of transaction execution, and weighing the system performance and transaction boundary design. The formula is as follows:

[0128] Cost=w1·T+w2·O

[0129] Where T is the transaction execution time, O is the number of transaction operations, w1 and w2 are the weights of each indicator, satisfying w1+w2=1.

[0130] Step 2.4: Design transaction boundaries based on rollback cost assessment and set transaction boundaries within an appropriate range to reduce the cost of rollback. Regularly analyze monitoring data and adjust transaction boundary design strategies based on system load and performance requirements.

[0131] Through the above algorithm design, the system can comprehensively evaluate the rollback cost based on the real-time monitoring data of transaction execution, and reduce the rollback cost and the negative impact on system performance by optimizing the design of transaction boundaries.

[0132] In summary, the system implements concurrency control and transaction processing on the database level, and uses database transactions to ensure atomicity, consistency, isolation, and persistence. Through pessimistic locking or optimistic locking strategies, the system can effectively solve concurrency problems, ensure the correctness and consistency of data during multi-user operations, and ensure the stability and reliability of the system.

[0133] Specifically, the real-time and asynchronous processing modules include:

[0134] Use Node.js and Express frameworks on the back end, integrate the WebSocket library (Socket.IO in this embodiment), and use the WebSocket API on the front end to establish a WebSocket connection with the back end. On the back end, monitor data change events, such as database triggers, business logic triggered events, or other sources of data changes. When there is a data change, encapsulate the changed data as a message and push it to the front end via WebSocket. On the back end, send real-time updated messages to the connected front end via WebSocket. In this embodiment, the message is in the JSON format of the data and contains updated information. On the front end, listen to message events through WebSocket, and after receiving new data, update the corresponding interface or trigger the corresponding business logic.

[0135] Among them, the establishment of the WebSocket communication channel needs to be completed when the system starts to ensure real-time communication between the backend and the frontend. The backend push mechanism needs to be integrated into the system's data change events to ensure that real-time updates can be triggered when data changes. In this embodiment, WebSocket message push needs to be combined with the front-end data processing logic to ensure that real-time updates can be correctly reflected in the user interface.

[0136] In summary, through the above settings, the system can use WebSocket technology to establish a real-time communication channel, implement the back-end push mechanism, and push data updates to the front-end in real time through WebSocket to maintain the real-time nature of the data. This implementation method can effectively improve the user experience and enable users to obtain important changes in the system in a timely manner.

[0137] Specifically, the asynchronous task processing module includes:

[0138] The long-running tasks are designed as asynchronous tasks. In this implementation, this is achieved by using the asynchronous framework Celery. In this embodiment, the Kafka message queue system is used. After installing and configuring the message queue, ensure that the system can establish a connection with the message queue.

[0139] The initiation and execution of tasks are decoupled. The place where the task is initiated sends the task information to the message queue instead of directly triggering the task execution. On the side of the task executor, the task information in the message queue is listened to, the task is obtained and executed.

[0140] The message queue is a key component of asynchronous tasks, and its high availability is crucial to the stable operation of the system. Therefore, this embodiment also includes:

[0141] A cluster is configured in the message queue system, including multiple nodes, which are distributed on different physical servers or virtual machines to ensure isolation between nodes, and to set up interconnection and synchronization mechanisms between nodes to ensure that nodes in the cluster can sense and synchronize data in the message queue with each other. In this embodiment, the consistency algorithm of the Raft protocol is used to ensure consistency of node status;

[0142] The configuration system monitors the node status and detects node failures in time. When a node fails, the system can automatically trigger a failover and transfer the workload to other normally operating nodes. A load balancing mechanism is used to ensure that requests in the message queue can be evenly distributed to each node in the cluster to prevent a certain node from becoming a bottleneck. A redundancy mechanism is set to ensure that even if a node fails, other nodes can still provide services. In this embodiment, this is achieved through master-slave replication. According to the system load situation, an automatic expansion and reduction mechanism is set to ensure that the system can dynamically adjust the number of nodes according to demand to adapt to changing workloads.

[0143] Through the above design, the message queue system can configure clusters, node interconnection, fault detection, load balancing, and redundancy mechanisms, thereby improving the high availability of the system's message queue, ensuring that the system can still run stably in the event of node failure or load changes, and reducing the impact of single point failures on the system.

[0144] How to ensure that the initiation and execution of tasks can be well decoupled to avoid excessive coupling is also very important. Therefore, this embodiment also includes:

[0145] Determine the format of the task information, including the task type, parameters, and executor identification. The task information should be clear enough so that the executor can correctly parse and execute it; create a task queue to store the task information to be executed. In this embodiment, a first-in-first-out (FIFO) queue is used; when a task needs to be initiated, the task information is queued into the task queue, which is implemented in this embodiment through the task scheduling component of the system;

[0146] The task executor periodically polls the task queue to check whether there are tasks to be executed. In this embodiment, the polling frequency is adjusted according to the real-time requirements and load conditions of the system;

[0147] The task executor takes the task information from the task queue, parses the task type and parameters, executes the corresponding task logic, and after execution is completed, updates the task status as needed or returns the execution result to the task initiator.

[0148] Through the above design, the system can achieve the decoupling of task initiation and execution. Task information is stored in the form of a queue. The task initiator puts the task information into the queue, and the task executor periodically polls the task queue, retrieves the task information and executes it. This design reduces the direct coupling between the task initiator and the executor, and improves the flexibility and maintainability of the system.

[0149] It should be noted that the design of the asynchronous task of the present invention takes into account the specific business logic of the task to ensure that the real-time performance of the system is not affected during asynchronous execution. The integration of the message queue needs to be completed during the system initialization phase to ensure that the communication channel between task initiation and execution is unobstructed.

[0150] Specifically, the user identity authentication and permission control module includes:

[0151] The JWT library is integrated into the system. This embodiment uses jsonwebtoken (Node.js environment) to configure the JWT key, expiration time and other parameters to ensure security and a reasonable validity period. The user provides identity information to log in. The backend verifies the user's identity. If the verification passes, a JWT is generated and returned to the frontend.

[0152] The backend uses a key to generate a JWT for the user's identity information; the generated JWT is sent to the frontend in a secure manner, in this embodiment through the HTTP Authorization header; the frontend adds the JWT to the Authorization header of the request each time; after receiving the request, the backend parses the JWT to verify its legitimacy and validity period.

[0153] Define fine-grained permission rules in the system, including data access rights and functional operation rights; perform permission checks on each protected resource or operation point to ensure that the user has the permission to perform the operation; if the permission check fails, return the corresponding error code or message to ensure that unauthorized users cannot access protected resources;

[0154] It should be noted that the generation and parsing of JWT needs to be performed on the back end and combined with the logic of user authentication to ensure that the generated JWT contains the correct user information. Fine-grained permission control needs to be performed at various key points in the system to ensure that users can only access data and functions for which they have permissions.

[0155] In summary, through the above design, the system can use JWT for user authentication and implement fine-grained permission control on this basis. This design can effectively ensure the user's secure access while protecting sensitive data and functions in the system from unauthorized users.

[0156] Specifically, the performance optimization and load balancing modules include:

[0157] Deploy a cache server. In this embodiment, Redis is used as the cache storage of the system, and the cache strategy is configured, including the cache expiration time and data elimination strategy. At the data access layer, such as before database access or external API call, check whether the requested data exists in the cache. If the data exists in the cache, it is directly returned to the client, skipping the subsequent database query or API call. If the data does not exist in the cache, a normal database query or API call is performed, and the result is stored in the cache.

[0158] When performing write operations, update the relevant cache in a timely manner, maintain the consistency of the cache and the database, and use an appropriate cache invalidation strategy to ensure that expired or invalid cache data is not returned.

[0159] Deploy a load balancer. In this embodiment, Nginx is used to distribute user requests to multiple backend servers. Multiple application servers are added to the backend of the load balancer to achieve horizontal expansion of the system. The newly added servers share requests through the load balancer, improving the overall performance and scalability of the system.

[0160] It should be noted that the cache read and write process needs to establish reasonable coordination between the data access layer and the cache layer to ensure data consistency. The deployment of the load balancer needs to be combined with the horizontal expansion of the application server to achieve the effect of load balancing.

[0161] In summary, through the above design, the system can reduce the database burden and improve data access speed through the caching mechanism. At the same time, through the deployment of the load balancer, it can realize the distribution of requests and the horizontal expansion of the system, and improve the overall performance and scalability of the system. This design can effectively cope with the high concurrency and large traffic situations faced by the system.

[0162] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein with equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the scope of protection of the claims of the present invention.

Claims

1. The business administration professional simulation training system is characterized by: The system comprises: Layered architecture, including front-end, back-end and database; Microservice architecture, which is used to split different functions into independent services; Concurrency control and transaction processing module, which uses database transactions to ensure the atomicity, consistency, isolation and durability of multi-user operations, and adopts optimistic locking and / or pessimistic locking strategies to address concurrency issues; Real-time and asynchronous processing module, used to establish real-time communication channels to notify users when data changes; Asynchronous task processing module, which designs long-running tasks as asynchronous tasks and uses message queues to decouple task initiation and execution; User authentication and permission control module, which is used for user authentication and permission control. JWT is used for user authentication and fine-grained permission control is implemented to ensure that users can only access data and functions for which they have permission. The performance optimization and load balancing module is used to use the caching mechanism to reduce the database burden, improve data access speed, and deploy a load balancer to distribute user requests to ensure that the system has horizontal scalability.

2. The business administration professional simulation training system according to claim 1 is characterized in that: The front-end uses the React framework to build the front-end application, implement the user interface, and split different functions into independent React components to improve the maintainability and reusability of the code. In the React front-end, HTTP requests are initiated through Fetch or Axios tools to communicate with the back-end, process asynchronous operations, and ensure timely updates of the user interface; The backend uses Node.js and Express frameworks to build backend services, encapsulating business logic and database access functions into different service modules to achieve loose coupling. In the Express backend, API routing is set, RESTful API is defined for front-end calls, middleware is used to ensure the legitimacy of requests, and identity authentication and authorization are implemented; The database uses PostgreSQL as a database management system to store the persistent data of the system; The microservice architecture splits different business logics into independent microservices according to system functions, and uses message queues for communication between microservices.

3. The business administration professional simulation training system according to claim 2 is characterized in that: The concurrency control and transaction processing module includes: Define a set of operations to be performed in the database as a transaction, and use the ACID characteristics provided by the database to ensure the correct execution of the transaction; Among them, the pessimistic locking strategy includes: using the row-level lock mechanism provided by the database before key operations to prevent other transactions from modifying the same row of data; setting the database transaction isolation level to ensure the isolation between transactions during concurrent execution; Among them, the optimistic locking strategy includes: introducing a version field in the data table to record the version number of the data, and comparing the version number when updating to ensure that the operation is based on the latest version of the data; Monitor errors in transactions, such as database operation exceptions or business logic errors, trigger the transaction rollback mechanism, undo all previously executed database operations, and maintain database consistency.

4. The business administration professional simulation training system according to claim 3 is characterized in that: The real-time and asynchronous processing module includes: Use Node.js and Express framework on the back end, integrate the WebSocket library, use the WebSocket API on the front end, and establish a WebSocket connection with the back end.

5. The business administration professional simulation training system according to claim 4 is characterized in that: The asynchronous task processing module includes: Use an asynchronous framework to design long-running tasks as asynchronous tasks; Install and configure the message queue to ensure that the system can establish a connection with the message queue; Decouple the initiation and execution of tasks. On the side that initiates the task, the task information is sent to the message queue. On the side that executes the task, the task information in the message queue is listened to, the task is obtained and executed.

6. The business administration professional simulation training system according to claim 5 is characterized in that: The message queue includes: Configure a cluster in the message queue, including several nodes distributed on different physical servers or virtual machines to ensure isolation between nodes; Set up interconnection and synchronization between nodes to ensure that nodes in the cluster can sense each other and synchronize data in the message queue; Monitor node status to detect node failures. When a node fails, the system triggers a failover and transfers the workload to other nodes that are operating normally. Use load balancing mechanism to ensure that the requests in the message queue can be evenly distributed to each node in the cluster; Set up a redundancy mechanism to ensure that if a node fails, other nodes can still provide services; According to the system load, set up automatic expansion and reduction mechanisms to ensure that the system can dynamically adjust the number of nodes according to demand to adapt to changing workloads.

7. The business administration professional simulation training system according to claim 6 is characterized in that: Decoupling the initiation and execution of a task includes: Determine the format of task information, including task type, parameters, and executor ID; Create a task queue to store task information to be executed; When a task needs to be initiated, the task information is added to the task queue; The task executor periodically polls the task queue to check whether there are tasks to be executed; The task executor takes the task information from the task queue, parses the task type and parameters, and executes the corresponding task logic; After the execution is completed, the task status is updated or the execution result is returned to the task initiator as needed.

8. The business administration professional simulation training system according to claim 1 is characterized in that: In the user identity authentication and permission control module, using JWT for user identity authentication includes: Integrate the JWT library into the system, configure the JWT key and expiration time parameters to ensure security and a reasonable validity period; The user provides identity information to log in; The backend verifies the user's identity. If the verification is successful, a JWT is generated and returned to the frontend. Generate JWT using the key against the user identity information on the backend; Send the generated JWT to the front end in a secure way; The front end adds JWT to the Authorization header of the request every time it makes a request; After receiving the request, the backend parses the JWT and verifies its legitimacy and validity period.

9. The business administration professional simulation training system according to claim 8, characterized in that: In the user identity authentication and permission control module, fine-grained permission control is implemented to ensure that users can only access data and functions for which they have permission, including: Define fine-grained permission rules in the system, including data access permissions and functional operation permissions; Perform permission checks on each protected resource or operation point to ensure that the user has the permission to perform the operation; If the permission check fails, the corresponding error code or message is returned to ensure that unauthorized users cannot access protected resources.

10. The business administration professional simulation training system according to claim 1, characterized in that: The performance optimization and load balancing module includes: Deploy a cache server as the system's cache storage and configure cache policies, including cache expiration time and data elimination policies; Before accessing the database, check whether the requested data exists in the cache; If the data exists in the cache, it is directly returned to the front end, skipping the subsequent database query; If the data does not exist in the cache, perform a normal database query and store the result in the cache; Deploy a load balancer to distribute user requests to the backend; Add multiple application servers behind the load balancer to achieve horizontal expansion of the system.