Derek Collison c75127b966 Benchmarks for stream limits, combine tests and benchmarks into fewer files (#4098)
- [ ] Link to issue, e.g. `Resolves #NNN`
 - [ ] Documentation added (if applicable)
 - [x] Tests added
- [x] Branch rebased on top of current main (`git pull --rebase origin
main`)
- [x] Changes squashed to a single commit (described
[here](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html))
 - [x] Build is green in Travis CI
- [x] You have certified that the contribution is your original work and
that you license the work to the project under the [Apache 2
license](https://github.com/nats-io/nats-server/blob/main/LICENSE)

### Changes proposed in this pull request:

- Add JetStream benchmark that measures publish throughput with
different limits (MaxBytes, MaxMessages, MaxPerSubject, MaxAge, ...)
- Merge `jetstream_chaos_*_test.go` and and
`jetstream_benchmark_*_test.go` into two files (down from 8)

Example output (filtered subset):

```
$ go test -v -bench 'BenchmarkJetStreamInterestStreamWithLimit/.*R=1.*/Storage=Memory/.*' -run NONE -benchtime 200000x -count 1

goos: darwin
goarch: arm64
pkg: github.com/nats-io/nats-server/v2/server
BenchmarkJetStreamInterestStreamWithLimit
    jetstream_benchmark_interest_stream_limit_test.go:44: BatchSize: 100, MsgSize: 256, Subjects: 2500, Publishers: 4, Random Message: true
BenchmarkJetStreamInterestStreamWithLimit/N=1,R=1
BenchmarkJetStreamInterestStreamWithLimit/N=1,R=1/Storage=Memory
BenchmarkJetStreamInterestStreamWithLimit/N=1,R=1/Storage=Memory/unlimited
    jetstream_benchmark_interest_stream_limit_test.go:230: Stream: {clusterSize:1 replicas:1}, Storage: [Memory] Limit: [unlimited], Ops: 200000
BenchmarkJetStreamInterestStreamWithLimit/N=1,R=1/Storage=Memory/unlimited-8              200000              9743 ns/op          26.28 MB/s             0 %error
BenchmarkJetStreamInterestStreamWithLimit/N=1,R=1/Storage=Memory/MaxMsg=1000
    jetstream_benchmark_interest_stream_limit_test.go:230: Stream: {clusterSize:1 replicas:1}, Storage: [Memory] Limit: [MaxMsg=1000], Ops: 200000
BenchmarkJetStreamInterestStreamWithLimit/N=1,R=1/Storage=Memory/MaxMsg=1000-8            200000              9800 ns/op          26.12 MB/s             0 %error
BenchmarkJetStreamInterestStreamWithLimit/N=1,R=1/Storage=Memory/MaxMsg=10
    jetstream_benchmark_interest_stream_limit_test.go:230: Stream: {clusterSize:1 replicas:1}, Storage: [Memory] Limit: [MaxMsg=10], Ops: 200000
BenchmarkJetStreamInterestStreamWithLimit/N=1,R=1/Storage=Memory/MaxMsg=10-8              200000              9717 ns/op          26.35 MB/s             0 %error
BenchmarkJetStreamInterestStreamWithLimit/N=1,R=1/Storage=Memory/MaxPerSubject=10
    jetstream_benchmark_interest_stream_limit_test.go:230: Stream: {clusterSize:1 replicas:1}, Storage: [Memory] Limit: [MaxPerSubject=10], Ops: 200000
BenchmarkJetStreamInterestStreamWithLimit/N=1,R=1/Storage=Memory/MaxPerSubject=10-8       200000             78796 ns/op           3.25 MB/s             0 %error
BenchmarkJetStreamInterestStreamWithLimit/N=1,R=1/Storage=Memory/MaxAge=1s
    jetstream_benchmark_interest_stream_limit_test.go:230: Stream: {clusterSize:1 replicas:1}, Storage: [Memory] Limit: [MaxAge=1s], Ops: 200000
BenchmarkJetStreamInterestStreamWithLimit/N=1,R=1/Storage=Memory/MaxAge=1s-8              200000              9648 ns/op          26.53 MB/s             0 %error
BenchmarkJetStreamInterestStreamWithLimit/N=1,R=1/Storage=Memory/MaxBytes=1MB
    jetstream_benchmark_interest_stream_limit_test.go:230: Stream: {clusterSize:1 replicas:1}, Storage: [Memory] Limit: [MaxBytes=1MB], Ops: 200000
BenchmarkJetStreamInterestStreamWithLimit/N=1,R=1/Storage=Memory/MaxBytes=1MB-8           200000              9706 ns/op          26.38 MB/s             0 %error
PASS
ok      github.com/nats-io/nats-server/v2/server        26.359s
```

cc: @jnmoyne
2023-04-27 16:53:31 -07:00
2023-04-25 11:28:59 +08:00
2021-07-13 10:07:31 +02:00
2023-04-17 00:07:01 -07:00
2023-04-27 07:19:56 -07:00
2022-08-03 14:01:55 -07:00
2023-04-16 15:33:13 -04:00
2018-03-15 11:38:25 -07:00
2022-08-16 16:48:00 -06:00
2023-04-21 14:18:54 -07:00
2023-04-21 14:18:54 -07:00
2020-11-10 10:40:28 -06:00
2018-03-15 22:31:07 -07:00
2023-03-17 15:09:50 -07:00
2020-06-22 11:10:49 -05:00
2023-04-17 10:05:18 -04:00

NATS Logo

NATS is a simple, secure and performant communications system for digital systems, services and devices. NATS is part of the Cloud Native Computing Foundation (CNCF). NATS has over 40 client language implementations, and its server can run on-premise, in the cloud, at the edge, and even on a Raspberry Pi. NATS can secure and simplify design and operation of modern distributed systems.

License Build Release Slack Coverage Docker Downloads CII Best Practices

Documentation

Contact

  • Twitter: Follow us on Twitter!
  • Google Groups: Where you can ask questions
  • Slack: Click here to join. You can ask question to our maintainers and to the rich and active community.

Contributing

If you are interested in contributing to NATS, read about our...

Roadmap

The NATS product roadmap can be found here.

Security

Security Audit

A third party security audit was performed by Cure53, you can see the full report here.

Reporting Security Vulnerabilities

If you've found a vulnerability or a potential vulnerability in the NATS server, please let us know at nats-security.

License

Unless otherwise noted, the NATS source files are distributed under the Apache Version 2.0 license found in the LICENSE file.

Description
No description provided
Readme Apache-2.0 33 MiB
Languages
Go 99.6%
Shell 0.4%