Git Product home page Git Product logo

demo-singleflight's Introduction

demo-singleflight

Clone project

git clone https://github.com/Supachai-Sukd/demo-singleflight.git

Install package

go mod tidy

Install Apache benchmark

Windows
choco install apache-httpd
source: https://chocolatey.org/packages/apache-httpd

Ubuntu
apt-get install apache2-utils 
source: https://bobcares.com/blog/apache-benchmark-install-ubuntu/

Mac
installed by default in macos

-n 100 หมายถึงจำนวนคำขอทั้งหมดที่จะส่ง
-c 10 หมายถึงจำนวนการร้องขอพร้อมกัน (concurrency)
-k หมายถึง Keep-Alive คงอยู่ในสถานะเชื่อมต่ออย่างต่อเนื่อง" ซึ่งเป็นการตั้งค่าให้เครื่องผู้ใช้ (client) ใช้การเชื่อมต่อ Keep-Alive เพื่อให้สามารถส่งคำร้องขอ (request) ได้มากกว่าหนึ่งครั้ง โดยไม่ต้องเปิดการเชื่อมต่อใหม่ทุกครั้งที่ส่งคำร้องขอใหม่

Test with singleflight

ab -k -n 100 -c 10 http://localhost:8080/singleflight

Test non singleflight

ab -k -n 100 -c 10 http://localhost:8080/normal

demo-singleflight's People

Watchers

 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.