Coder Social home page Coder Social logo

deminy / couchbase-benchmark Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 208 KB

To benchmark Couchbase performance in a non-blocking web server.

Home Page: https://hub.docker.com/r/deminy/couchbase-benchmark

Dockerfile 1.41% Shell 1.09% PHP 97.50%
php swoole couchbase hyperf benchmark

couchbase-benchmark's Introduction

This repository is to run benchmark with Couchbase servers.

How Is the Benchmark Performed

  • The benchmarks are done using the Apache ab tool.
  • The web server creates a few persistent Couchbase connections in advance. The # of persistent Couchbase connections is the same as the # of CPU core.
  • The 1st benchmark makes 500 HTTP requests in total, with 100 concurrent threads.
  • The 2nd benchmark makes 500 HTTP requests in total. The # of concurrent threads is the same as the # of persistent Couchbase connections.
  • Each HTTP request performs 24 Couchbase operations, including get(), insert(), upsert(), replace(), counter(), and remove().

The benchmark tool works with Couchbase server 6.5 to 7.2. Other versions of Couchbase server are not tested.

How to Run a Benchmark

Run following command to benchmark with a specific Couchbase server:

docker run --rm \
    -e COUCHBASE_HOST= \
    -e COUCHBASE_USER= \
    -e COUCHBASE_PASS= \
    -e COUCHBASE_BUCKET= \
    -ti deminy/couchbase-benchmark

You need to update Docker environment variable COUCHBASE_HOST, COUCHBASE_USER, COUCHBASE_PASS, and COUCHBASE_BUCKET first before running above command.

Assuming that we have a Couchbase certificate file ./couchbase.pem and we want to use it to run benchmarks:

docker run --rm \
    -v "$(pwd)/couchbase.pem:/couchbase.pem" \
    -e COUCHBASE_HOST= \
    -e COUCHBASE_USER= \
    -e COUCHBASE_PASS= \
    -e COUCHBASE_BUCKET= \
    -e COUCHBASE_OPTIONS="truststorepath=/couchbase.pem&wait_for_config=true" \
    -ti deminy/couchbase-benchmark

# or, if we don't want to validate the SSL certificate while benchmarking. This should be used for debugging purposes only.
docker run --rm \
    -v "$(pwd)/couchbase.pem:/couchbase.pem" \
    -e COUCHBASE_HOST= \
    -e COUCHBASE_USER= \
    -e COUCHBASE_PASS= \
    -e COUCHBASE_BUCKET= \
    -e COUCHBASE_OPTIONS="truststorepath=/couchbase.pem&ssl=no_verify&wait_for_config=true" \
    -ti deminy/couchbase-benchmark

Commands for Local Development

# Coding style fixes.
docker run --rm -v "$(pwd):/var/www" -w /var/www -i jakzal/phpqa:php8.1 php-cs-fixer fix

# To build the Docker image. We build AMR64 images only because there is no download link for ARM64.
docker build --platform linux/amd64 --build-arg PHP_VERSION=8.0 -t deminy/couchbase-benchmark .

# To read the manual of command "ab".
docker run --rm --entrypoint "/bin/sh" -ti deminy/couchbase-benchmark -c "ab -h"
# To install PHP packages.
docker run --rm -v "$(pwd):/var/www" --entrypoint "/bin/sh" -ti deminy/couchbase-benchmark -c "composer install -n"

If you want to test the benchmark script locally, you can start a Couchbase container first, then use it to run the benchmark script, like following:

# Start a Couchbase container.
docker run --rm -d --name couchbase -e CB_ADMIN=username -e CB_ADMIN_PASSWORD=password -e CB_BUCKET=test -t deminy/couchbase:7.2.2

# Run a benchmark with the Couchbase container.
docker run --rm --platform=linux/amd64 \
    -e COUCHBASE_HOST=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' couchbase) \
    -ti deminy/couchbase-benchmark

# Stop the Couchbase container.
docker stop couchbase

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.