Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance degradation #5394

Open
nenych opened this issue May 7, 2024 · 2 comments
Open

Performance degradation #5394

nenych opened this issue May 7, 2024 · 2 comments
Labels
defect Suspected defect such as a bug or regression

Comments

@nenych
Copy link

nenych commented May 7, 2024

Observed behavior

Performance degradation after the slow consumer connection.
As you can see below, we are observing about 30% degradation of the incoming messages when the slow consumer connected, and about 50% after the second one.

CleanShot 2024-05-07 at 16 58 44@2x

Expected behavior

Stop sending messages to the slow consumers until their buffers are empty without slowing down the server.

Server and client version

Server: 2.9.20
Python library: nats-py 2.7.2

Host environment

Local:
MacOS 14.4.1, arm64, Docker 26.0.0
The same behavior with the amd64 emulator (--platform=linux/amd64 flag).

GKE
Container-Optimized OS, amd64, containerd

Steps to reproduce

Prepared required configs and docker-compose file that will start NATS, Prometheus, an exporter, and two consumers: https://github.com/nenych/nats-test.

Steps to run

  1. Clone the repository.
  2. Build the docker image:
docker build -t test/nats:latest .
  1. Install NATS cli: https://docs.nats.io/using-nats/nats-tools/nats_cli
  2. Run docker-compose (will start NATS, prometheus and 2 consumers):
docker-compose -f ./docker-compose.yaml up -d
  1. Start NATS benchmark:
nats bench updates --pub=4 --msgs 1000000000 --size=1000
  1. Wait a little and start the slow consumer:
docker run --rm -it --network=nats-test_default test/nats:latest python3 slow-consumer.py

Explore metrics

  1. Open prometheus: http://localhost:9091/graph
  2. Insert query:
sum by (job) (rate(nats_varz_in_msgs[30s]))
@nenych nenych added the defect Suspected defect such as a bug or regression label May 7, 2024
@ripienaar
Copy link
Contributor

Server 2.9.20 is now quite a while out of date, let us know how latest 2.10 works for you.

@nenych
Copy link
Author

nenych commented May 7, 2024

Below you can see the same test with the NATS 2.10.14, with this version we have even worse results:

CleanShot 2024-05-07 at 18 36 04@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

No branches or pull requests

2 participants