Font Size: a A A

Research And Realization Of The Web Server Framework Based On Node.js

Posted on:2022-03-13Degree:MasterType:Thesis
Country:ChinaCandidate:B TangFull Text:PDF
GTID:2518306491996809Subject:Computer technology
Abstract/Summary:PDF Full Text Request
As a relatively new language,Node.js is more efficient than traditional server-side languages in high-concurrency I/O scenarios due to its asynchronous I/O characteristics,and has gradually become the mainstream server-side development language in recent years.Due to the short development time of Node.js,the web server framework based on Node.js is currently in the development stage.Through the analysis of the mainstream Node.js web server frameworks,this paper finds the following deficiencies: the configuration information of functional attributes is directly defined in the business code,which causes the configuration information to be mixed with the business code,brings inconvenience in code maintenance;the request scheduling scheme is relatively simple,which is easy to cause the loss of the request in the high concurrency scenario;the caching strategy of static resources is single,which leads to the low loading efficiency of static resources;the traditional cache replacement algorithm is used for cache replacement,the cache hit rate is not high in the case of limited cache space.To solve these problems,this paper designs and implements a web server framework based on Node.js.The main works of this paper are as follows:Firstly,this paper introduces the development status of the Node.js web server framework,expounds the advantages and disadvantages of the mainstream Node.js web server framework.Secondly,based on the modularization mechanism,the core functional modules of the Web server framework,such as request management,parameter processing,filter,router,session management and static resource management are designed and implemented in combination with the actual development scenarios.On this basis,aiming at the deficiency of mainstream framework,optimizing the following points:(1)The function attributes are defined through the configuration file,which separates the configuration information from the business code and improves the maintainability of the code;(2)The delayed scheduling scheme based on cache queues is adopted to achieve peak-shift processing of requests in high concurrency scenarios through delayed scheduling,which reduces the request error rate of the framework;(3)The double-caching strategy of combining client-side and server-side caching is used to cache static resources,which reduces the number of requests and file I/O operations,improves the static resource loading efficiency of the framework;(4)A cache replacement algorithm based on the Gaussian mixture model is proposed.The cache replacement algorithm uses Gaussian mixture model to predict the resources that will be accessed again within the window time and replace the cache based on the prediction result.Experimental results show that this algorithm effectively improves the hit rate and byte hit rate compared with the traditional cache replacement algorithms.Finally,a comprehensive test of the framework is completed.The test results show that compared with the mainstream Node.js web server frameworks,this framework has obvious advantages in static resource loading efficiency,request error rate and request processing efficiency,which proves the rationality of the framework design.Currently,this framework is available on the Node.js package management platform NPM and has a certain amount of downloads.
Keywords/Search Tags:Node.js, Web server framework, Request scheduling, Cache replacement
PDF Full Text Request
Related items