Giter Site home page Giter Site logo

requestpool's Introduction

go 如何用高并发qps项目的研究与实现

  • 基本概念

    其实最主要的还是一个链接池的概念,和利用一些channel之间通信的操作,相信用过sync.pool这个golang内置的库或者有研究的话,理解起来就很方便了。

    • payload 工作任务对象

      具体的任务对象,可以有不同种类的工作任务函数
      
    • worker 工作者对象

      包含:启动、停止、创建等动作
      
      Start: Start方法启动worker的运行循环,监听退出通道以防必要的时候我们需要停止它
      
      WorkerPool chan chan Job		//工作队列
      JobChannel chan Job 			//工作对象池-工作缓冲通道
      
      
    • dispatcher 管理者(管理工作任务的分发和调度)

       包含: 创建、运行、任务分发
       
       任务分发就是:从工作队列JobQueue监听是否有新的工作,
       如果有的话则派发到WorkerPool工作者队列里面的JobChannel,
       worker则从该通道中取出对应的工作,并执行对应的工作任务
      
  • 实测环境 ubuntu 64bit 2核4GB

    200000   ~ 1.255300401s
    300000   ~ 2.027193592s
    400000   ~ 3.306656942s
    500000   ~ 3.650426811s
    1000000QPS 
    
  • 列举一些可以应用的领域

    • 分布式服务DB
    • 分布式架构请求处理

requestpool's People

Contributors

lei314121077 avatar

Watchers

James Cloos avatar Madara avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.