Code Monkey home page Code Monkey logo

nostr-bench's Introduction

Nostr relay benchmaker

cargo install nostr-bench
nostr-bench --help

# Usage: nostr-bench <COMMAND>
# 
# Commands:
#   connect  Benchmark create websocket connections
#   echo     Benchmark send websocket message, the server should send back the message
#   event    Benchmark publish nostr event
#   req      Benchmark request nostr event
#   help     Print this message or the help of the given subcommand(s)
nostr-bench connect --help

# Usage: nostr-bench connect [OPTIONS] <URL>
# 
# Arguments:
#   <URL>  Nostr relay host url
# 
# Options:
#   -c, --count <NUM>      Max count of clients [default: 100]
#   -r, --rate <NUM>       Start open connection rate every second [default: 50]
#   -k, --keepalive <NUM>  Close connection after second, ignore when set to 0 [default: 0]
#   -t, --threads <NUM>    Set the amount of threads, default 0 will use all system available cores [default: 0]
#   -i, --interface <IP>   Network interface address list
#       --json             Display stats information as json, time format as milli seconds
#   -h, --help             Print help

Get more connections

Since the system limits a network interface to connect up to 64k, you can set --interface to bind more interface to increase the number of connections

nostr-bench connect 'ws://127.0.0.1:8080' --interface 192.168.0.2 --interface 192.168.0.3

Increase resource usage limits

Linux

ulimit -n 1000000
sudo sysctl -w net.ipv4.ip_local_port_range="1025 65534"

Mac OS

ulimit -n 1000000
# sysctl net.inet.ip.portrange
sudo sysctl -w net.inet.ip.portrange.first=1025
sudo sysctl -w net.inet.ip.portrange.last=65534

nostr-bench's People

Contributors

arronzhang avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

22388o

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.