基于Node.js高并发web系统的研究与应用
发布时间:2018-01-26 20:31
本文关键词: Node.js 高并发 事件驱动 异步I/O 出处:《电子科技大学》2014年硕士论文 论文类型:学位论文
【摘要】:随着互联网技术的深入发展和广泛应用,越来越多的网站面临高并发访问的压力。保证高并发Web系统的高效性和稳定性是当今Web技术中的重要课题。传统的方法主要通过负载均衡、缓存、集群等后端架构来提升其并发处理能力,而对于HTTP服务器本身性能并没有太大的提升。Node.js技术是当今最热门的服务器端技术。它在保持与传统技术兼容的情况下,采用基于事件驱动的异步I/O模型,极大地提高了HTTP服务器的并发性能。因此,研究基于Node.js的高并发Web系统有着重要的现实意义。本文分析了高并发Web系统面临的挑战,从一些大型高并发网站架构入手,总结现有的高并发解决方案。接着,研究了Node.js的组织架构和工作原理,将Node.js的I/O模型与传统I/O模型进行对比,详述了多线程多进程模型的弊端以及Node.js的核心技术——基于事件驱动的异步I/O模型,并分析该模型在高并发、高负载环境下的性能优势。由于Node.js原生是单线程的工作模式,为了利用服务器多核的优势,本文在深入研究各种Node.js多核方案的基础上,设计了一种简单、高效的Node.js多核并行框架,并基于该框架实现了Node.js多核HTTP服务器。该服务器不仅发挥了Node.js模型在高并发以及I/O性能方面的优势,而且解决了由于Node.js单线程导致的多核CPU利用率的问题,使得HTTP服务器的并发性能得到极大地提升。为了与实际应用相结合,本文设计并实现了一个基于Node.js的微博系统。首先,提出该系统的总体架构。然后,基于MongoDB设计了数据模式,实现了数据的持久化存储。接着,利用Redis设计了分层的缓存层,实现数据在内存级存储。还引入并实现了RabbitMQ消息队列,降低了HTTP服务器的压力,提高吞吐量。最后,本文在真实环境中对该系统进行了测试,并与传统实现进行对比,证明了Node.js更为适合高并发Web系统。
[Abstract]:With the deep development and wide application of Internet technology. More and more websites are facing the pressure of high concurrent access. To ensure the high efficiency and stability of high concurrent Web system is an important issue in the current Web technology. Traditional methods are mainly through load balancing, caching. A back-end architecture such as a cluster improves its concurrency processing capabilities. However, there is not much improvement in the performance of the HTTP server itself. Node.js technology is the most popular server-side technology today. It remains compatible with traditional technologies. The use of event-based asynchronous I / O model greatly improves the concurrency performance of HTTP servers. It is of great practical significance to study the high concurrent Web system based on Node.js. This paper analyzes the challenges faced by the high concurrent Web system and starts with the architecture of some large and high concurrent web sites. Summarize the existing solutions of high concurrency. Then, study the organization structure and working principle of Node.js, compare the I / O model of Node.js with the traditional I / O model. In this paper, the disadvantages of multithreading and multi-process model and the core technology of Node.js, the event-driven asynchronous I / O model, are described in detail, and the high concurrency of this model is analyzed. Performance advantages in high-load environments. Because Node.js native is a single-threaded mode of work, in order to take advantage of the advantages of multi-core server. Based on the research of various Node.js multi-core schemes, a simple and efficient Node.js multi-core parallel framework is designed in this paper. Based on this framework, the Node.js multi-core HTTP server is implemented, which not only takes advantage of the Node.js model in high concurrency and I / O performance. And it solves the problem of multi-core CPU utilization caused by single thread of Node.js, which greatly improves the concurrent performance of HTTP server. In this paper, a Weibo system based on Node.js is designed and implemented. Firstly, the overall architecture of the system is presented. Then, the data pattern is designed based on MongoDB. Data persistence storage is realized. Then, the hierarchical buffer layer is designed using Redis to store data at memory level. RabbitMQ message queue is also introduced and implemented. It reduces the pressure of HTTP server and improves the throughput. Finally, the system is tested in real environment and compared with the traditional implementation. It is proved that Node.js is more suitable for high concurrent Web systems.
【学位授予单位】:电子科技大学
【学位级别】:硕士
【学位授予年份】:2014
【分类号】:TP393.09;TP311.52
【参考文献】
相关期刊论文 前1条
1 凌质亿;刘哲星;曹蕾;;高并发环境下Apache与Nginx的I/O性能比较[J];计算机系统应用;2013年06期
,本文编号:1466515
本文链接:https://www.wllwen.com/guanlilunwen/ydhl/1466515.html