24小时论文定制热线

热门毕设:土木工程工程造价桥梁工程计算机javaasp机械机械手夹具单片机工厂供电采矿工程
您当前的位置:论文定制 > 毕业设计论文 >
快速导航
毕业论文定制
关于我们
我们是一家专业提供高质量代做毕业设计的网站。2002年成立至今为众多客户提供大量毕业设计、论文定制等服务,赢得众多客户好评,因为专注,所以专业。写作老师大部分由全国211/958等高校的博士及硕士生设计,执笔,目前已为5000余位客户解决了论文写作的难题。 秉承以用户为中心,为用户创造价值的理念,我站拥有无缝对接的售后服务体系,代做毕业设计完成后有专业的老师进行一对一修改与完善,对有答辩需求的同学进行一对一的辅导,为你顺利毕业保驾护航
代做毕业设计
常见问题

使用C、PHP语言开发百度贴吧中间层设计

添加时间:2019/02/23 来源:哈尔滨工业大学 作者:王益静
详细阐述了关于 PHP 中间层在提供接口使用上的关于重要配置文档以及相关异常流的说明。最后,通过详细的对 PHP 中间层进行高并发模拟操作,并对实验结果进行分析,论证了设计上的满足系统需求。
以下为本篇论文正文:

摘 要

  贴吧是百度旗下独立品牌,全球最大的中文社区。百度贴吧历经 10 年沉淀,拥有 6 亿注册用户,450 万贴吧,日均话题总量近亿,月活跃用户数有 2 亿,占中国网民总数的 39%。贴吧是基于 LAMP 架构下的解决方案成果,目前支撑了数十个子系统、十亿的流量、千万级提交量以及 T 级数据量。贴吧目前需要的是高性能、高稳定性、高扩展性、更快的响应时间、更好的用户体验以及快速开发/方便维护的架构/代码。而作为承载如此重担的 PHP 中间层却面临着很多问题,无法很好的解决贴吧高并发、高负载的需求。

  论文从贴吧产品的需求点出发,以宏观架构以及后台具体处理流程为切入点,分析系统 PHP 中间层的问题,总结出系统的瓶颈以及流程上的缺陷,并提出具体系统功能需求以及相关技术改进方案。从技术角度介绍了改进方案的具体实施细节,比如架构重构、流程优化、进程同步等,为之后的具体实现提供理论基础以及方案参考。

  本文使用 C、PHP 语言开发出了贴吧架构下的中间层,承载高并发、高负载的需求,在设计上主要分为六大模块:资源定位、健康检查、负载均衡、协议支持、统一接口、本地配置自动化。首先通过对中间层的架构重构,包括资源定位与健康检查,以及 MySQL 请求架构。再通过对系统工作进程相关流程的高度抽象,从抽象的流程上分析出系统瓶颈点,并针对瓶颈点进行深入的调研,从而确定设计方案。在负载均衡上,通过非主控式的设计方案,并从进程交互与进程同步等关键点出发,开发出符合贴吧高并发、高负载的系统,使 T 级请求下的平均响应时间达到小于 5 秒的要求。在系统的对外接口以及跨系统调用方面,也详细阐述了关键服务的配置以及异常定位。最后在系统部署方面,也很好的讨论了系统有关平滑上线以及相关服务映射的特性。

  通过上述的设计,系统解决了瓶颈问题,满足了性能上的需求,提升了用户体验。经过实际的测试,以及一期工程下的具体部署,通过符合预期的结果,证明了架构重构的完美以及具体技术方案的可行性。目前 PHP 中间层的改进方案已经部署到贴吧后台的 12 个服务器,后续的二期工程会完全部署并推广到其他的子系统中。

  关键词:百度贴吧;中间层;系统架构;高并发;负载均衡

Abstract

  Baidu's Post Bar is an independent brand, the world's largest Chinese community. After 10 years of precipitation, Baidu Post Bar has 600 million registered users, 4.5 million of it, the total daily topic of hundred million, the number of monthly active users, 200 million, accounting for 39 % of China's total Internet users. Post Bar is a solution based on the results of LAMP architecture currently supports dozens of sub-systems, billions of traffic, the amount of ten million, and T -stage submission data. Post Bar is needed for a high-performance , high stability, high scalability, faster response time , better user experience and rapid development / easy maintenance architecture / code. As the burden of carrying such a PHP middle layer are facing a lot of problems , not a good solution to paste it high concurrency, high load demand .

  This paper products from the demand point of departure paste it to specific macroeconomic framework and background processing as a starting point, problem analysis system PHP middle layer , summed bottlenecks and defect processes on the system, and to propose specific functional requirements of the system and related technology improvements solution. From a technical perspective on the specific implementation details of the improvement program, such as architecture reconstruction, process optimization, process synchronization, etc., to provide the theoretical basis and reference for the concrete realization of the program after .

  This paper has developed the middle layer for php, using C and PHP Language, carrying high concurrency and high load demand.The design is divided into six modules : Resource Locator, health checks, load balancing, protocol support, unified interface, automated configuration. First, through the reconstruction of the middle layer of the architecture, including resource location and health checks, as well as MySQL request architecture. Then work through the system highly abstract processes related processes, from the abstract process to analyze the system bottlenecks, and conduct in-depth research for bottleneck points, in order to determine design. On load balancing, through non-pilot type design, and interact with the synchronization process from the process critical point of view, developed in line paste it high concurrency, high system load, the average response time T to reach the next level of less than 1 request s requirements. In the external interface system and cross-system calls, it also elaborated on configuration and abnormal localization of critical services. Finally, system deployment, the system is also very good discussion about the smooth lines and related service mapping features.

  Through the above design, the system solves the bottleneck problems and meets the needs of performance, and enhances the user experience. After the actual test , as well as specific projects under the first phase of deployment, the middle layer proves the feasibility of specific technical solutions and perfect architecture reconstruction,through the results in line with expectations. Currently, PHP improvement program has been deployed to the middle layer and paste it back in 12 servers. The subsequent Phase II project will be fully deployed and extended to other sub-systems.

  Keywords: Baidu Post Bar, middle layer, system architecture, high concurrent, load balance

  本课题来源于百度在线网络(北京)有限公司(以下简称百度公司)。百度公司是一家综合性的互联网公司,同时也是全球最大的中文引擎搜索,涉及到网页、贴吧、音乐、图片等多种产品。贴吧产品运营相对独立,是国内涉足社交平台最早的重量级产品。贴吧历经 10 年沉淀,拥有 6 亿注册用户,450 万贴吧,日均话题总量近亿,月活跃用户数有 2 亿,占中国网民总数的 39%。贴吧是基于 LAMP 架构下的解决方案成果,目前支撑了数十个子系统、十亿的流量、千万级提交量以及 T 级数据量。在现有的环境与条件下,贴吧目前需要的是高性能、高稳定性、高扩展性、更快的响应时间、更好的用户体验以及快速开发/方便维护的架构/代码,在这样的前提下我们研究的课题应运而生。

  因为互联网的普及,用户的持续增多,以及用户对互联网应用的用户体验质量越来越高,尤其是服务器的响应速度,这些都对 Web 性能提出了较高的要求[2]。大规模服务器集群的需要越来越迫切。需要解决的问题便是如何低成本的构建高可用、高性能的系统[3]。目前,国内外的各大公司都针对自己的业务需求,开发并推广出了自身的集群架构,也因为他们的努力,多个开源的负载系统孕育而生[4]。只可惜这些开源系统只是专注于某一领域下的某一方面的问题解决,而没有从宏观的角度,构建整套的解决方案[5]。

  LAMP(Linux-Apache-MySQL-PHP)网站架构是目前国际流行的 Web 框架[15],该框架由四大部分的首字母组成,四大部分分别是:Linux,Apache,MySQL,Perl、PHP 或者 Python 编程语言。LAMP 的优势是价格低、性能高、跨平台以及可通用[16]。

  Apache 是 LAMP 架构的 Web Server,经过时间的大量考验,Apache 是一个开源的 Web 服务器,模块丰富是其一个很显着的优点[17]。不过,目前轻量级的Web 服务器程序,例如 Nginx 等逐渐因为其高效的响应处理能力而慢慢的取代了现今愈加臃肿的 Apache。Nginx 不支持 PHP 语言,但是它在负载均衡方面,有很好的作用,所以,可以让它与 Apache 一起协作,来更好的负载 PHP[18]。

  MySQL 作为一个开源的数据库,其经过多个大公司,包括阿里巴巴、百度、腾讯等的完善以及高并发操作的考验,事实证明,MySQL 在处理集群、事务等方面的能力不输于现今数据库的老大 Oracle。在处理服务器的稳定连接数量方面,MySQL 也表现的十分的出色[19]。

  综上所述,可得知,LAMP 是一个非常优秀的网站架构,其在高访问量的负载方面,绝对是一个很优秀的方案[20]。

  百度贴吧中间层设计:

图 3-4 CT 架构
CT 架构

主从架构
主从架构

Filter 设计类图
Filter 设计类图

MSHUTDOWN 进程步骤异常说明
MSHUTDOWN 进程步骤异常说明

LOAD & RELOAD 进程步骤异常说明
LOAD & RELOAD 进程步骤异常说明

PHP LOAD 进程步骤异常说明
PHP LOAD 进程步骤异常说明

目 录

  摘 要
  ABSTRACT
  第 1 章 绪论
    1.1 课题来源及研究意义
    1.2 与课题相关的国内外研究综述
      1.2.1 高并发与高负载的研究
      1.2.2 LAMP 架构
      1.2.3 负载均衡与 LVS
    1.3 本论文的主要工作内容
  第 2 章 PHP 中间层需求与关键技术分析
    2.1 名词解释
    2.2 功能现状分析
    2.3 总体设计
    2.4 功能性需求
      2.4.1 统一接口
      2.4.2 协议支持与数据格式转化
      2.4.3 资源定位
      2.4.4 负载均衡
      2.4.5 服务运行状态检查
      2.4.6 精细化控制
      2.4.7 本地配置与自动化加载
      2.4.8 数据库的配合
    2.5 非功能性需求
      2.5.1 性能需求
      2.5.2 异常定位
      2.5.3 配置文档完整性
    2.6 系统关键技术分析
      2.6.1 系统架构方案
      2.6.2 资源定位与服务运行状态检查
      2.6.3 负载均衡
    2.7 本章小结
  第 3 章 PHP 中间层的详细设计及实现
    3.1 中间层的架构设计
      3.1.1 资源定位与服务运行状态检查
      3.1.2 MySQL 请求架构
    3.2 Camel PHP Lib 实现
      3.2.1 设计实现
      3.2.2 数据库反馈交互信息
    3.3 Camel.so 实现
      3.3.1 处理流程
      3.3.2 连接池
      3.3.3 设计实现
    3.4 超级负载均衡
      3.4.1 设计实现
      3.4.2 Filter
      3.4.3 重构设计
      3.4.4 多协议支持
    3.5 服务信息的热加载
    3.6 配置示例
      3.6.1 Camel.conf
      3.6.2 Service.conf
      3.6.3 Protocol.conf
    3.7 需要考虑的问题
      3.7.1 平滑上线
      3.7.2 关于服务映射
    3.8 本章小结
  第 4 章 PHP 中间层配置与异常说明
    4.1 配置
      4.1.1 配置简介
      4.1.2 系统配置
      4.1.3 CAMEL 进程配置
      4.1.4 资源定位伽利略配置
      4.1.5 WORKER 进程配置
      4.1.6 伽利略本地备份配置
    4.2 异常日志
      4.2.1 PHP 主进程
      4.2.2 CAMEL 进程
      4.2.3 PHP 工作进程
    4.3 本章小结
  第 5 章 PHP 中间层的测试和结果分析
    5.1 测试工具
    5.2 测试环境
    5.3 测试流程
      5.3.1 脚本编写
      5.3.2 执行脚本
    5.4 测试数据分析
    5.5 测试结论
    5.6 本章小结
  结 论
  参考文献
  哈尔滨工业大学学位论文原创性声明和使用权限
  致 谢
  个人简历

(如您需要查看本篇毕业设计全文,请您联系客服索取)

相关内容
相关标签:PHP毕业设计
好优论文定制中心主要为您提供代做毕业设计及各专业毕业论文写作辅导服务。 网站地图
所有论文、资料均源于网上的共享资源以及一些期刊杂志,所有论文仅免费供网友间相互学习交流之用,请特别注意勿做其他非法用途。
如有侵犯您的版权或其他有损您利益的行为,请联系指出,论文定制中心会立即进行改正或删除有关内容!