作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程

• 体系结构与软件技术 • 上一篇    下一篇

一种内核级多进程负载均衡会话保持方法

张颖楠1a,1b,1c,顾乃杰1a,1b,1c,彭建章1a,1b,1c,王国澎2,魏振伟1a,1b,1c   

  1. (1. 中国科学技术大学 a. 计算机科学与技术学院;b. 安徽省计算与通讯软件重点实验室;
  • 收稿日期:2013-03-19 出版日期:2014-03-15 发布日期:2014-03-13
  • 作者简介:张颖楠(1988-),女,硕士、CCF会员,主研方向:网络负载均衡;顾乃杰,博士、博士生导师;彭建章,博士;王国澎、魏振伟,硕士。
  • 基金资助:
    “核高基”重大专项(2009ZX01028-002-003-005);高等学校学科创新引智计划基金资助项目(B07033)。

A Kernel Level Session-persistence Method for Multi-process Load Balancing

ZHANG Ying-nan  1a,1b,1c, GU Nai-jie  1a,1b,1c, PENG Jian-zhang  1a,1b,1c, WANG Guo-peng  2, WEI Zhen-wei  1a,1b,1c   

  1. (1a. School of Computer Science and Technology; 1b. Anhui Province Key Laboratory of Computing and Communication 1c. USTC&SICT Network and Communication Joint Laboratory, University of Science and Technology of China, Hefei 230027, China; 2. National High Performance IC Design Center, Shanghai 201204, China)
  • Received:2013-03-19 Online:2014-03-15 Published:2014-03-13

摘要: 针对多进程负载均衡无法保持会话的问题,提出一个基于epoll机制的内核级高效解决方法。对于每个新建立的连接,在epoll的通知机制中使用源地址哈希算法,由epoll通知哈希选出的进程接收此连接,期望通过为同一个IP地址的请求选择同一个负载均衡服务进程,保证该进程依据自身记录的会话信息将同一个客户的请求转发给同一个后端服务器。此外,通过分析多队列网卡的特性,给出维持收包发包中断、软中断、协议栈处理、用户态处理都在同一个核上的优化方法,以提高cache性能。实验结果表明,该方法能解决基于epoll的多进程负载均衡服务器的会话保持问题,并且在多核处理器多队列网卡环境下通过优化使cps提高12%,数据吞吐量提高4.6%。

关键词: 多队列网卡, 多核, epoll机制, 源地址哈希, 会话保持

Abstract: This paper proposes an efficient method at the kernel level to solve the problem how to maintain the session in multi-process load balancing. In the wakeup-callback mechanism of epoll, this method wakes up a certain service process selectively to process the packet and accept this connection according to the source address hash algorithm. It hopes that the requests sharing the same IP address are responded by the same service process. So the requests from the same client are forwarding to the same backend server according to the session information kept in this load balancing process. This paper also devotes to optimize the performance of the procedure of receiving and sending packets. It is an intended way to keep this whole process on the same CPU core to reduce the refresh rate of the CPU cache. Experimental results reflect that the method in this paper achieves the objective to keep the session and also increases cps by 12% and throughput by 4.6% which is based on multi-queue NIC and multi-core processor.

Key words: multi-queue network card, multi-core, epoll mechanism, source address hash, session-persistence

中图分类号: