CN113221083B - Block chain user session caching method capable of improving server performance - Google Patents

Block chain user session caching method capable of improving server performance Download PDF

Info

Publication number
CN113221083B
CN113221083B CN202110617691.XA CN202110617691A CN113221083B CN 113221083 B CN113221083 B CN 113221083B CN 202110617691 A CN202110617691 A CN 202110617691A CN 113221083 B CN113221083 B CN 113221083B
Authority
CN
China
Prior art keywords
login
user
session
memory
sessionid
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110617691.XA
Other languages
Chinese (zh)
Other versions
CN113221083A (en
Inventor
洪薇
洪健
李京昆
刘文思
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hubei Yangzhong Jushi Information Technology Co ltd
Original Assignee
Hubei Yangzhong Jushi Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hubei Yangzhong Jushi Information Technology Co ltd filed Critical Hubei Yangzhong Jushi Information Technology Co ltd
Priority to CN202110617691.XA priority Critical patent/CN113221083B/en
Publication of CN113221083A publication Critical patent/CN113221083A/en
Application granted granted Critical
Publication of CN113221083B publication Critical patent/CN113221083B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention relates to the technical field of blockchain management, in particular to a blockchain user session caching method capable of improving the performance of a server. After the blockchain management system logs in, the background service is restarted, the front-end operation is not influenced, an operator does not feel about the recovery of the user login session, the user login session is recovered from the mysql database, the user login session invalidation caused by the restarting of the back-end service is avoided, the server performance is improved, the user login session in the memory is checked preferentially, the user login session in the mysql database is checked again, the database pressure is prevented from being excessively high each time the database is read directly, and the advantages of the user login session in the memory and the persistent user login session in the mysql database are combined and integrated are provided for the user.

Description

Block chain user session caching method capable of improving server performance
Technical Field
The invention relates to the technical field of blockchain management, in particular to a blockchain user session caching method capable of improving server performance.
Background
The block chain management system is a platform which takes the block chain service as a core and displays data on the block chain. The blockchain management system is based on accounts, and menus, roles and buttons are authority systems.
User login is the most basic function of the blockchain management system, and any operation is performed on the blockchain management system, so that a login session is needed to acquire operation authority.
At present, the user login is processed by inputting an account and a password, checking the password in the background, returning a checking result, storing login session in the background if the checking result is correct, returning user information, storing the user information in a cookie by a browser, and dividing the background storage session into two types, wherein one type is stored in a memory and the other type is stored in a database or a file.
After restarting the background service running on the server, the login session is invalid on a browser interface accessing the service, and the login interface on the browser is required to be logged in again; if a user operates the service on the browser, the service running on the server in the background is restarted, the user cannot operate on the browser, the login is overdue or the login is invalid, and the user needs to log in again, which is very unfriendly to the user.
Secondly, the data is stored in a database or a file, belongs to a persistent session, and under the condition of high concurrency, the server is under high pressure, the database or the system file can be frequently read and written, and the performance pressure of the server is overlarge.
Accordingly, one skilled in the art provides a blockchain user session caching method capable of improving server performance to solve the above-mentioned problems in the background art.
Disclosure of Invention
The invention aims to provide a block chain user session caching method capable of improving server performance so as to solve the problems in the background technology.
In order to achieve the above purpose, the present invention provides the following technical solutions: a block chain user session caching method capable of improving server performance comprises the following steps:
step 1: invoking a blockchain management system login interface in a blockchain management system on a browser, and verifying login user information and a user login password;
step 2: after confirming that the login user information is background backup user information and the login password is correct, taking sessionID as a credential, storing the user information into a login session of a memory and a mysql database, and feeding back the logged user information to a browser page for displaying the page and controlling authority of a blockchain management system;
step 3: when a user wants to log in again due to improper operation or closing of a login page, acquiring a background sessionID from a browser page, acquiring a user login session from a memory by using sessionID credentials, and directly returning the login session to the browser page and passing login verification when the acquisition is successful;
step 4: when no user login session of sessionID exists in the memory, acquiring the user session from the mysql database by sessionID, if the acquisition is successful, recovering the login session in the memory, simultaneously returning the login session to a browser page, and passing login verification, if the acquisition of the user login session in the mysql database fails, failing the user login session or having no login information;
step 5: and setting a timing task for the MySQL database, and periodically executing to store the user information in the memory into MySQL.
As a further aspect of the present invention: the sessionID is randomly generated according to a rule, the session ID is taken as a credential, user information and login information are stored in a memory and a mysql database, wherein the login information comprises login time, IP and expiration time.
As a further aspect of the present invention: the browser page stores user information in the form of cookies.
As a further aspect of the present invention: the specific operation in the step 5 is as follows: the user login session in the circulating memory is firstly obtained through the sessionID and the user information, after the login session is successfully obtained, whether the login session is out of date is checked, the validity period is refreshed in the validity period, and the user is directly returned after the validity period is exceeded.
Compared with the prior art, the invention has the beneficial effects that:
1. after the user logs in the blockchain management system, the background service is restarted, the front-end operation is not influenced, an operator does not feel about the recovery of the user login session, the user login session is recovered from the mysql database, and the user login session failure caused by the restarting of the back-end service is avoided.
2. The server performance is improved, the user login session in the memory is checked preferentially, and the user login session in the mysql database is checked again, so that the database is prevented from being excessively stressed under the condition of high concurrency when the database is directly read each time.
3. The advantages of the user login session in the memory and the persistent user login session in the mysql database are combined, and the advantages of the user login session and the persistent user login session are integrated, so that high-quality service is provided for the user.
Drawings
FIG. 1 is a flow chart of a blockchain user session caching method that can improve server performance.
Detailed Description
Referring to fig. 1, in an embodiment of the present invention, a blockchain user session caching method capable of improving server performance includes the following steps:
step 1: invoking a blockchain management system login interface in a blockchain management system on a browser, and verifying login user information and a user login password;
step 2: after confirming that the login user information is background backup user information and the login password is correct, using sessionID as a credential to store the user information into a login session of a memory and a mysql database, and simultaneously feeding back the logged user information to a browser page for displaying the page and controlling the authority of a blockchain management system (the login process, namely the blockchain management system, creates the user session after confirming the user information and the password are correct, stores the session information into the memory and the mysql database, and returns the session ID to a browser operation page);
step 3: when a user wants to log in again due to improper operation or closing of a login page, acquiring a background sessionID from a browser page, acquiring a user login session from a memory by using sessionID credentials, and directly returning the login session to the browser page and passing login verification when the acquisition is successful;
step 4: when no user login session of sessionID exists in the memory, acquiring the user session from the mysql database by sessionID, if the acquisition is successful, recovering the login session in the memory, simultaneously returning the login session to a browser page, and passing login verification, if the acquisition of the user login session in the mysql database fails, failing the user login session or having no login information;
step 5: and setting a timing task for the MySQL database, and periodically executing to store the user information in the memory into MySQL.
Further, the sessionID is randomly generated according to a rule, for example, the beegosessionID_xxxx is used as a prefix, and a section of random number is added;
taking the session ID as a credential, user information and login information including login time, IP and expiration time are stored in a memory and mysql database.
Further, the browser page stores user information in the form of a cookie.
Further, the specific operation in step 5 is as follows: the user login session in the circulating memory is firstly obtained through the sessionID and the user information, after the login session is successfully obtained, whether the login session is out of date is checked, the validity period is refreshed in the validity period, and the user is directly returned after the validity period is exceeded.
Application example 1:
the user accesses the blockchain management system on the browser, and the current page of the blockchain management system is closed because other emergency matters need to be processed, and when the user returns to process the business of the blockchain management system, the user needs to log in again;
the invention solves the problem that the user can continue to operate only by opening the previous operation page without logging in again;
the implementation process comprises the following steps: the method comprises the steps of obtaining a session ID of a blockchain management system from a cookie in a browser, namely a session ID, attaching the session ID when the blockchain management system calls a back-end interface, and recovering a session through the session ID in background service of the blockchain management system.
Application example 2:
the user accesses the blockchain management system on the browser, and the conversation in the memory is lost due to the upgrading of the background service of the blockchain management system (the restarting of the background service), and when the user operates, the conversation cannot be verified in the background service of the blockchain management system, so that the conversation is prompted to be lost in the browser and the user logs in again;
the invention solves the problem that the session is lost in the memory caused by the later service upgrade (background service restart), and the session can be recovered from the mysql database, and the mysql data is durable.
Application example 3:
when a large number of users concentrate on accessing the blockchain management system in the same time period, if a background service adopts a mysql database to verify a session, the system is blocked, the request time is added, and the like;
the invention uses the mode of combining the memory and the mysql database to recover the session ID, firstly detects whether the session exists in the memory, and if the session is not recovered by going to the mysql database, the invention takes the advantage of the shortages to form a user session solution method with high access efficiency and sustainable data.
The foregoing description is only a preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art, who is within the scope of the present invention, should make equivalent substitutions or modifications according to the technical solution of the present invention and the inventive concept thereof, and should be covered by the scope of the present invention.

Claims (4)

1. A block chain user session caching method capable of improving server performance is characterized by comprising the following steps:
step 1: invoking a blockchain management system login interface in a blockchain management system on a browser, and verifying login user information and a user login password;
step 2: after confirming that the login user information is background backup user information and the login password is correct, taking sessionID as a credential, storing the user information into a login session of a memory and a mysql database, and feeding back the logged user information to a browser page for displaying the page and controlling authority of a blockchain management system;
step 3: when a user wants to log in again due to improper operation or closing of a login page, acquiring a background sessionID from a browser page, acquiring a user login session from a memory by using sessionID credentials, and directly returning the login session to the browser page and passing login verification when the acquisition is successful;
step 4: when no user login session of sessionID exists in the memory, acquiring the user session from the mysql database by sessionID, if the acquisition is successful, recovering the login session in the memory, simultaneously returning the login session to a browser page, and passing login verification, if the acquisition of the user login session in the mysql database fails, failing the user login session or having no login information;
step 5: and setting a timing task for the MySQL database, and periodically executing to store the user information in the memory into MySQL.
2. The blockchain user session caching method capable of improving server performance according to claim 1, wherein sessionID is randomly generated according to rules; taking the session ID as a credential, user information and login information including login time, IP and expiration time are stored in a memory and mysql database.
3. The blockchain user session caching method capable of improving server performance of claim 1, wherein the browser page stores the user information in the form of a cookie.
4. The blockchain user session caching method capable of improving server performance according to claim 1, wherein the specific operations in step 5 are as follows: the user login session in the circulating memory is firstly obtained through the sessionID and the user information, after the login session is successfully obtained, whether the login session is out of date is checked, the validity period is refreshed in the validity period, and the user is directly returned after the validity period is exceeded.
CN202110617691.XA 2021-06-02 2021-06-02 Block chain user session caching method capable of improving server performance Active CN113221083B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110617691.XA CN113221083B (en) 2021-06-02 2021-06-02 Block chain user session caching method capable of improving server performance

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110617691.XA CN113221083B (en) 2021-06-02 2021-06-02 Block chain user session caching method capable of improving server performance

Publications (2)

Publication Number Publication Date
CN113221083A CN113221083A (en) 2021-08-06
CN113221083B true CN113221083B (en) 2023-05-16

Family

ID=77082548

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110617691.XA Active CN113221083B (en) 2021-06-02 2021-06-02 Block chain user session caching method capable of improving server performance

Country Status (1)

Country Link
CN (1) CN113221083B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118093528A (en) * 2024-04-25 2024-05-28 飞狐信息技术(天津)有限公司 Drawing board data storage method and device, storage medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9021566B1 (en) * 2012-05-31 2015-04-28 Starnet Communications Corporation Apparatus and method to securely connect to and manage X11 applications on a remote system through an HTTP client
CN105337990A (en) * 2015-11-20 2016-02-17 北京奇虎科技有限公司 User identity verification method and device
CN107317831A (en) * 2016-04-27 2017-11-03 上海炬宏信息技术有限公司 Website access method based on memory database
CN111475519A (en) * 2020-04-01 2020-07-31 深圳市思迪信息技术股份有限公司 Data caching method and device
CN111683045A (en) * 2020-04-28 2020-09-18 中国平安财产保险股份有限公司 Session information processing method, device, equipment and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103532919B (en) * 2012-07-06 2018-06-12 腾讯科技(深圳)有限公司 User account keeps logging in the method and system of state
CN106209744B (en) * 2015-05-07 2019-08-06 阿里巴巴集团控股有限公司 Subscriber sign-in conversation management-control method, device and server
CN105978994B (en) * 2016-06-22 2019-01-18 武汉理工大学 A kind of login method of web oriented system
CN107294970A (en) * 2017-06-23 2017-10-24 武汉票据交易中心有限公司 A kind of client logs in and exited method and system
CN107483466B (en) * 2017-08-30 2020-11-24 苏州浪潮智能科技有限公司 User login verification method and device in Web application

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9021566B1 (en) * 2012-05-31 2015-04-28 Starnet Communications Corporation Apparatus and method to securely connect to and manage X11 applications on a remote system through an HTTP client
CN105337990A (en) * 2015-11-20 2016-02-17 北京奇虎科技有限公司 User identity verification method and device
CN107317831A (en) * 2016-04-27 2017-11-03 上海炬宏信息技术有限公司 Website access method based on memory database
CN111475519A (en) * 2020-04-01 2020-07-31 深圳市思迪信息技术股份有限公司 Data caching method and device
CN111683045A (en) * 2020-04-28 2020-09-18 中国平安财产保险股份有限公司 Session information processing method, device, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于集群节点间即时拷贝的会话同步技术研究;曹海涛;计算机系统应用;全文 *

Also Published As

Publication number Publication date
CN113221083A (en) 2021-08-06

Similar Documents

Publication Publication Date Title
CN112306743B (en) Data processing method, device, electronic equipment and computer storage medium
CN107770140A (en) A kind of single sign-on authentication method and device
CN109639730A (en) Information system data interface authentication method under HTTP stateless protocol based on token
US9747288B1 (en) Scalable transaction-based data repository service
CN104410674B (en) A kind of WEB session synchronization methods of single-node login system
WO2007059534A9 (en) Distributed transaction history management system
CN103139200A (en) Single sign-on method of web service
CN113221083B (en) Block chain user session caching method capable of improving server performance
CN106656514A (en) kerberos authentication cluster access method, SparkStandalone cluster, and driving node of SparkStandalone cluster
CN106453396A (en) Double token account login method and login verification device
CN111343145A (en) Redis-based single sign-on method and device
CN109120616A (en) A kind of identity identifying method, device, agency service end and storage medium
US20120317620A1 (en) Website visitor identification algorithm
CN110601832A (en) Data access method and device
CN113901495A (en) Shiro framework-based user identification security verification method and device and computer medium
CN104935555B (en) client certificate authentication method, server, client and system
CN108234122B (en) Token checking method and device
CN109829321B (en) Method, device, equipment and storage medium for authenticating identity
CN109714363B (en) Method and system for modifying switch password
CN106789930A (en) A kind of single-point logging method of (SuSE) Linux OS
US20120079573A1 (en) Information processing device, password diagnosing method and computer-readable medium
CN115296877B (en) Method for invalidation and renewal of JWT storage token
US10164990B2 (en) Security test tool
US20180373603A1 (en) Web Application System and Database Utilization Method Therefor
CN116010926A (en) Login authentication method, login authentication device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant