Git Product home page Git Product logo

Comments (12)

icebob avatar icebob commented on May 26, 2024 3

NATS fixed the issue in 2.16.0, my results:

image

from moleculer.

icebob avatar icebob commented on May 26, 2024 1

plz try with the latest version 2.9.21

from moleculer.

icebob avatar icebob commented on May 26, 2024 1

I've found the problem inside the nats library. The sending logic is changed to queue-based in 2.x.x version. Skipping this logic I could reach 30.000 msg/sec instead of 40 msg/sec. I've opened an issue in the NATS client repo: nats-io/nats.js#581

from moleculer.

icebob avatar icebob commented on May 26, 2024

It looks that it's an issue with the nats library version 2.x.x. With the previous 1.x.x version the performance is fine.
There is an open issue (2 years ago) about it in NATS repo: nats-io/nats.js#438

from moleculer.

mrprigun avatar mrprigun commented on May 26, 2024

For more context, libs:

"moleculer": "0.14.31",
"nats": "2.15.1",

Used OS for local testing: MacOS 13.5
Service images in the k8s cluster are based on node:18-alpine

from moleculer.

icebob avatar icebob commented on May 26, 2024

Could you switch back to nats 1.4.12 to check the performance with this version as well?

from moleculer.

mrprigun avatar mrprigun commented on May 26, 2024

Already tried. Initially, it was using nats 1.4.12 and the results were pretty similar, that's why I moved to 2.15.1.

from moleculer.

icebob avatar icebob commented on May 26, 2024

What is the NATS server version?

from moleculer.

mrprigun avatar mrprigun commented on May 26, 2024

2.9.11, if more concrete docker.io/bitnami/nats:2.9.11-debian-11-r0

from moleculer.

mrprigun avatar mrprigun commented on May 26, 2024

It appears that I've identified the root cause of the issue. Upon experimenting with various broker settings, I found that disabling the metrics feature resolved the problem. In my project, I use a StatsD reporter. Everything is functioning as anticipated with the Prometheus reporter. The StatsD reporter configuration looks like this

{
        type: 'StatsD',
        options: {
          // Server host
          host: 'localhost',
          // Server port
          port: 8125,
          // Maximum payload size.
          maxPayloadSize: 1300,
        }
},

So it seems definitely not the NATS issue. I'll turn off StatsD for now.

from moleculer.

icebob avatar icebob commented on May 26, 2024

It's strange because I can reproduce this issue without any metrics, only with 2.x.x nats lib.

from moleculer.

mrprigun avatar mrprigun commented on May 26, 2024

This is a significant improvement, waiting for this fix then 😃

Pushed my tests just in case https://github.com/mrprigun/moleculer-benchmark-test There are two dedicated nodes and nats in docker-compose. With enabled StatsD reporter I receive ~170rps, with disabled reporter it's ~2k rps on my laptop.

Nats service: 2.9.21
Nats lib: 2.15.1
Node: v18.15.0
OS: MacOS 13.5

from moleculer.

Related Issues (20)

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.