Font Size: a A A

Research And Implementation Of The ORM Framework Based On Node.js

Posted on:2024-09-01Degree:MasterType:Thesis
Country:ChinaCandidate:L H ZhaoFull Text:PDF
GTID:2568307073468704Subject:Computer technology
Abstract/Summary:PDF Full Text Request
With the rapid development of software technology,object-oriented programming has gradually become the mainstream of programming architecture technology,while relational database is still the primary choice of data storage in most application systems.There are differences in model theory and metadata description between the two,which greatly affect the efficiency of software application development.Thus,the Object-relational Mapping(ORM)framework emerges as The Times require,which solves the impedance mismatch problem between the Object model and the Relational model.In recent years,the birth of Node.js,a new server language,has brought a new experience to application server development.Due to its event-driven non-blocking I/O operation mode,it makes the server more efficient in handling IO-intensive operations under high concurrent requests,and has been applied and supported in more and more server development.However,the development time of Node.js technology is short,and a large number of application development frameworks are still in the development stage,especially in the ORM technology,there is not yet an excellent framework design.This paper analyzes the source code of the current mainstream Node.js ORM frameworks,and finds that there are several shortcomings in the following aspects:(1)Object persistence operations need to be translated into standard SQL to execute,and the existing frameworks have too many processing redundancy,which leads to low translation efficiency and seriously affects the execution performance of the framework;(2)Lack of reuse mechanism for database connection object in asynchronous programming,which leads to the repeated creation of connections for each asynchronous task,resulting in a waste of resources and time;(3)In the process of object persistence,the data state synchronization mechanism between the application and the database is not provided,which may lead to dirty data operations and increase programming logic.The purpose of this paper is to design and implement an ORM framework based on Node.js to solve the shortcomings of mainstream frameworks.The specific work is as follows:This paper first introduces the development status and technical theory of ORM framework,and expounds the advantages and disadvantages of the current mainstream framework based on Node.js operating environment.Then,combined with the development requirements of persistence layer,the overall structure of the framework is designed and implemented.Based on the complete coverage of the content of the framework,the following optimizations are completed:(1)simplifying the redundancy processing in the translation process to improve the translation performance of the framework;(2)Through the Async Local Storage in Node.js,the thread safety mechanism similar to other languages is simulated,which simplifies the reuse of database connection objects in asynchronous programming;(3)An object state management model mechanism is designed to solve the synchronization problem of data state between applications and databases,and to avoid data misoperation on the basis of reducing frequent data detection.Finally,this paper completes the comprehensive test of the framework.Compared with the mainstream Node.js ORM framework,it provides a more concise programming scheme,and has a significant improvement in execution efficiency,which proves the rationality of the framework design.At present,Relaen has been released as a stable version after several iterations and has 6000+ downloads on Npm,a Node.js package management platform.
Keywords/Search Tags:Object relational model, Node.js, ORM framework
PDF Full Text Request
Related items