diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..9e98d52 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,70 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + schedule: + - cron: '19 18 * * 4' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://git.io/codeql-language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..45c1120 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,26 @@ +# .github/workflows/github-release-publish.yml +name: Publish artifacts to github release + +on: + release: + types: [published] + +jobs: + releases-matrix: + name: Release Go Binary + runs-on: ubuntu-latest + strategy: + matrix: + goos: [linux, darwin] + goarch: [amd64, arm64] + steps: + - uses: actions/checkout@v3 + - uses: wangyoucao577/go-release-action@v1.28 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + goos: ${{ matrix.goos }} + goarch: ${{ matrix.goarch }} + binary_name: "./bin/ftsb_redisearch" + sha256sum: true + asset_name: ftsb_redisearch-${{ matrix.goos }}-${{ matrix.goarch }} + build_command: "make ftsb_redisearch" diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index c205014..ec2d88b 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -16,4 +16,4 @@ jobs: # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml config-name: release-drafter-config.yml env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index 217b5c8..c985015 100644 --- a/Makefile +++ b/Makefile @@ -30,14 +30,12 @@ fmt: ftsb_redisearch: test $(GOBUILD) -o bin/$@ ./cmd/$@ - $(GOINSTALL) ./cmd/$@ get: $(GOGET) ./... test: get - release: $(GOGET) github.com/mitchellh/gox $(GOGET) github.com/tcnksm/ghr diff --git a/README.md b/README.md index 1759cfe..99df2f6 100644 --- a/README.md +++ b/README.md @@ -46,16 +46,44 @@ The aggregate queries are designed to be extremely costly both on computation an ### Installation -FTSB is a collection of Go programs (with some auxiliary bash and Python scripts). The easiest way to get and install the Go programs is to use go get and then issuing make: +#### Download Standalone binaries ( no Golang needed ) + +If you don't have go on your machine and just want to use the produced binaries you can download the following prebuilt bins: + +https://github.com/RediSearch/ftsb/releases/latest + +| OS | Arch | Link | +| :--- | :---: | ---: | +| Linux | amd64 (64-bit X86) | [ftsb_redisearch-linux-amd64](https://github.com/RediSearch/ftsb/releases/latest/download/ftsb_redisearch-linux-amd64.tar.gz) | +| Linux | arm64 (64-bit ARM) | [ftsb_redisearch-linux-arm64](https://github.com/RediSearch/ftsb/releases/latest/download/ftsb_redisearch-linux-arm64.tar.gz) | +| Darwin | amd64 (64-bit X86) | [ftsb_redisearch-darwin-amd64](https://github.com/RediSearch/ftsb/releases/latest/download/ftsb_redisearch-darwin-amd64.tar.gz) | +| Darwin | arm64 (64-bit ARM) | [ftsb_redisearch-darwin-arm64](https://github.com/RediSearch/ftsb/releases/latest/download/ftsb_redisearch-darwin-arm64.tar.gz) | + +Here's how bash script to download and try it: + +```bash +wget -c https://github.com/RediSearch/ftsb/releases/latest/download/ftsb_redisearch-$(uname -mrs | awk '{ print tolower($1) }')-$(dpkg --print-architecture).tar.gz -O - | tar -xz + +# give it a try +./ftsb_redisearch --help ``` + + +#### Installation in a Golang env + +To install the benchmark utility with a Go Env do as follow: + +```bash # Fetch FTSB and its dependencies go get github.com/RediSearch/ftsb cd $GOPATH/src/github.com/RediSearch/ftsb # Install desired binaries. At a minimum this includes ftsb_redisearch binary: make -``` +# give it a try +./bin/ftsb_redisearch --help +``` @@ -96,11 +124,16 @@ Apart from the CSV files, and not mandatory, there is a benchmark suite specific So that benchmarking results are not affected by generating data or queries on-the-fly, you are always required to feed an input file to the benchmark runner that respects the previous specification format. The overall idea is that the benchmark runner only concerns himself on executing the queries as fast as possible while enabling client runtime variations that influence performance ( and are not related to the use-case himself ) like, command pipelining ( auto pipelining based on time or number of commands ), cluster support, number of concurrent clients, rate limiting ( to find sustainable throughputs ), etc… Running a benchmark is as simple as feeding an input file to the DB benchmark runner ( in this case ftsb_redisearch ): -``` + +```bash + ftsb_redisearch --file ecommerce-inventory.redisearch.commands.BENCH.csv ``` + + The resulting stdout output will look similar to this: -``` + +```bash $ ftsb_redisearch --file ecommerce-inventory.redisearch.commands.BENCH.csv setup writes/sec writes/sec updates/sec reads/sec cursor reads/sec deletes/sec current ops/sec total ops TX BW/sRX BW/s 0 (0.000) 0 (0.000) 1571 (2.623) 288 (7.451) 0 (0.000) 0 (0.000) 1859 (3.713) 1860 3.1KB/s 1.4MB/s @@ -122,30 +155,35 @@ Issued 9885 Commands in 5.455sec with 8 workers Overall TX Byte Rate: 3KB/sec Overall RX Byte Rate: 1.4MB/sec ``` + + Apart from the input file, you should also always specify the name of JSON output file to output benchmark results, in order to do more complex analysis or store the results. Here is the full list of supported options: -``` -$ ftsb_redisearch -h -Usage of ftsb_redisearch: + +```bash +$ ./ftsb_redisearch --help +Usage of ./bin/ftsb_redisearch: + -a string + Password for Redis Auth. -cluster-mode If set to true, it will run the client in cluster mode. + -continue-on-error + If set to true, it will continue the benchmark and print the error message to stderr. -debug int Debug printing (choices: 0, 1, 2). (default 0) -do-benchmark Whether to write databuild. Set this flag to false to check input read speed. (default true) - -file string - File name to read databuild from -host string The host:port for Redis connection (default "localhost:6379") + -input string + File name to read databuild from -json-out-file string Name of json output file to output benchmark results. If not set, will not print to json. -max-rps uint enable limiting the rate of queries per second, 0 = no limit. By default no limit is specified and the binaries will stress the DB up to the maximum. A normal "modus operandi" would be to initially stress the system ( no limit on RPS) and afterwards that we know the limit vary with lower rps configurations. -metadata-string string Metadata string to add to json-out-file. If -json-out-file is not set, will not use this option. - -pipeline-max-size int - If limit is zero then no limit will be used and pipelines will only be limited by the specified time window (default 100) - -pipeline-window-ms float - If window is zero then implicit pipelining will be disabled (default 0.5) + -pipeline int + Pipeline requests. Default 1 (no pipeline). (default 1) -reporting-period duration Period to report write stats (default 1s) -requests uint