Code Monkey home page Code Monkey logo

thundering_herd_problem's Introduction

thundering_herd_problem

主要写了三个例子,server_accept.cpp和server_epoll.cpp分别验证accept和epoll的惊群问题,server_epoll_thp.cpp是仿照nginx避免惊群的方式的一个简单实现。更多说明见nginx如何解决惊群效应

get start

g++ -o server_accept server_accept.cpp -pthread -g
g++ -o server_epoll server_epoll.cpp -pthread -g
g++ -o server_epoll_thp server_epoll_thp.cpp -pthread -g

usage: ./server_*** [-i ip] [-p port] [-ap] [-n proc_num]
-a set reuse addr
-p set reuse port
-i set bind addr, default value is INADDR_ANY
-p set bind port, default value is 9000
-n set process num, default value is 1

test

  • accept
    ./server_accept -n 2 -a
    ab -c 1 -n 5 127.0.0.1:9000/

  • epoll
    ./server_epoll -n 2 -a
    ab -c 1 -n 5 127.0.0.1:9000/

  • epoll_thp
    ./server_epoll -n 2 -a
    ab -c 1 -n 5 127.0.0.1:9000/

thundering_herd_problem's People

Contributors

eesly avatar

Watchers

James Cloos avatar  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.