GithubHelp home page GithubHelp logo

fpm-iot-mqtt-golang's Introduction

fpm-iot-mqtt-golang

mqtt 服务器的 golang 版本

Features

  • pub/sub Mqtt Message
  • Save message into influxDB(Optionally)
  • Login required
  • Debug Console(Restful or Webui)

MQTT Servers

  • yfsoftcom/mqtt-server

    • Deploy
    docker run -d \
      -e MQTT_AUTH='{"foo":"bar"}' \
      -p 1884:1883 \
      --name fpm-mqtt-server \
      yfsoftcom/fpm-mqtt-server:latest
    
  • emqx/emqx github

    ** WARNNING: 955 clients max **

    Run the command $ ulimit -n 2048 can fix the issue (Reset after reboot)

    $ echo "* - nofile 2100000" >> /etc/security/limits.conf
    $ ulimit -a
    
    docker run -d --name emqx \
      -e EMQX_ALLOW_ANONYMOUS=false \
      -e EMQX_LISTENER__TCP__EXTERNAL=1883 \
      -e EMQX_LISTENER__TCP__EXTERNAL__ACCEPTORS=64 \
      -e EMQX_LISTENER__TCP__EXTERNAL__MAX___CONNECTIONS=1024000 \
      -e EMQX_NODE__PROCESS___LIMIT=2097152 \
      -e EMQX_NODE__MAX___PORTS=1048576 \
      -e EMQX_LOADED_PLUGINS="emqx_management,emqx_auth_username,emqx_recon,emqx_retainer,emqx_rule_engine,emqx_dashboard" \
      -p 18083:18083 -p 1883:1883 -p 8080:8080 \
      emqx/emqx:latest
    
    • Login Dashboard http://localhost:18083 with user/pass: admin/public

    • Change Password

    • Create App

    • Add MQTT User

      • list usernames
      curl -v --basic -u 7289cb89f9b54:MjkwMDQ4ODU0NTM5NTA3NjM1MzcyMjk1NDYyOTIwNTE5NjI -H "Content-Type: application/json" \-k http://localhost:8080/api/v3/auth_username
      
      • add username
      curl -v --basic -u 7289cb89f9b54:MjkwMDQ4ODU0NTM5NTA3NjM1MzcyMjk1NDYyOTIwNTE5NjI -H "Content-Type: application/json" -d \
        '{"username":"foo", "password": "bar"}' \-k http://localhost:8080/api/v3/auth_username
      
      • get username
      curl -v --basic -u 7289cb89f9b54:MjkwMDQ4ODU0NTM5NTA3NjM1MzcyMjk1NDYyOTIwNTE5NjI -H "Content-Type: application/json" \-k http://localhost:8080/api/v3/auth_username/admin
      
      • pub a message
      curl -v --basic -u 7289cb89f9b54:MjkwMDQ4ODU0NTM5NTA3NjM1MzcyMjk1NDYyOTIwNTE5NjI -H "Content-Type: application/json" -d \
        '{"qos":1, "retain": false, "topic":"world", "payload":"test" , "client_id": "C_1492145414740"}' \-k http://localhost:8080/api/v3/mqtt/publish
      
  • VolantMQ/volantmq github

    Best option is to run prebuilt docker image

    docker run --rm -p 1883:1883 -p 8080:8080 -v $(pwd)/examples/config.yaml:/etc/volantmq/config.yaml --env VOLANTMQ_CONFIG=/etc/volantmq/config.yaml volantmq/volantmq

MQTT Benchmark Tools

  • emqx/emqtt-bench github

  • krylovsk/mqtt-benchmark github

    $ go get github.com/krylovsk/mqtt-benchmark

    $ mqtt-benchmark --broker tcp://localhost:1883 --count 10 --size 100 --clients 100 --qos 2 --format json --quiet

    $ mqtt-benchmark --broker tcp://localhost:1883 --count 10 --size 100 --clients 500 --qos 2 --format text

    • test mosca $ mqtt-benchmark --broker tcp://localhost:1884 --username foo --password bar --count 20 --size 50 --clients 50 --qos 2 --format text --quiet

    • test emqx $ mqtt-benchmark --broker tcp://localhost:1883 --username foo --password bar --count 100 --size 1000 --clients 2000 --qos 2 --format text --quiet

    ========= TOTAL (1900) =========
    Total Ratio:                 1.000 (1900000/1900000)
    Total Runtime (sec):         119.363
    Average Runtime (sec):       118.472
    Msg time min (ms):           0.188
    Msg time max (ms):           422.708
    Msg time mean mean (ms):     117.632
    Msg time mean std (ms):      0.967
    Average Bandwidth (msg/sec): 8.441
    Total Bandwidth (msg/sec):   16038.289
    
    ========= TOTAL (20000) =========
    Total Ratio:                 1.000 (2000000/2000000)
    Total Runtime (sec):         165.999
    Average Runtime (sec):       100.311
    Msg time min (ms):           0.183
    Msg time max (ms):           2013.597
    Msg time mean mean (ms):     459.941
    Msg time mean std (ms):      199.541
    Average Bandwidth (msg/sec): 1.128
    Total Bandwidth (msg/sec):   22557.205
    
  • inovex/mqtt-stresser github

    $ docker run inovex/mqtt-stresser -broker tcp://localhost:1883 -num-clients 100 -num-messages 10 -rampup-delay 1s -rampup-size 10 -global-timeout 180s -timeout 20s

Tcp Banchmark Tool

Topics

fpm-iot-mqtt-golang's People

Watchers

 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.