GithubHelp home page GithubHelp logo

hasura / streaming-subscriptions-benchmark Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 0.0 76 KB

This repository contains details about how to setup to benchmark streaming subscriptions.

Shell 100.00%

streaming-subscriptions-benchmark's Introduction

Streaming subscriptions benchmark

This repository contains details about how to setup to benchmark streaming subscriptions.

Setup

The graphql-bench tool was used to benchmark the streaming subscriptions.

Tables setup

The following tables were added:

  1. messages - Table from which the messages were streamed
  2. channels
  3. users
  4. channel_user_mappings
  5. messages_initial_data - Table that contains 10k random messages and this will be inserted into the messages table repeatedly

These tables's DDL SQL can be found at schema_setup.sql.

If you'd like to seed the tables with some random data, then please use the data_setup.sql.

After creating the tables, the hasura metadata for the setup can be found at hasura_metadata.json and just by adding the connection string for your database the metdata can be imported and then the benchmarks can be run.

While the benchmark is run, concurrently 10k messages are inserted per second. This can be done by running the insert_messages.sh script. NOTE that for this, there needs to be 10k messages first in the messages_initial_data.

Running the benchmarks

  1. Use the config.subscription.yaml in this repository to use the config for subscription benchmarks in graphql-bench.
  2. The query used to run the benchmarks is
subscription ($id_range: bigint!, $userid_range: Int!) {
  messages_stream(
    cursor: { initial_value: { id: $id_range } }
    batch_size: 10
    where: { channel: { channel_users: { user_id: { _eq: $userid_range } } } }
  ) {
    message
  }
}

The above query simulates the authorization part in the where clause, generally this would be abstracted from the role by having this in the select permission. This is done here this way because we will be able to use the graphql-bench out of the box, with a range of values of userid_range.

Benchmarks results

The benchmarks were run on two different setups:

  1. Single 8XCPU and 32GB RAM (t3.2xlarge instance) and Postgres (2xCPU and 8 GB RAM)

1300 concurrent streaming subscriptions

DB benchmark stats

Max postgres connections - 19

CPU load average - 9 %

Hasura benchmark stats

CPU load average - 15 %

  1. Five 4xCPU and 8 GB RAM using App runner and Postgres (16xCPU and 32GB RAM)

20000 concurrent streaming subscriptions

Hasura CPU utilization

CPU Utilization

DB CPU utilization

DB CPU Utilization

DB Connections

DB connections

streaming-subscriptions-benchmark's People

Contributors

codingkarthik avatar

Stargazers

Mario Costa Junior avatar sina avatar AlbertGao avatar Praveen Durairaju avatar

Watchers

Aaron Johnson avatar Vamshi Surabhi avatar  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.