nats-io / nats-server

High-Performance server for NATS.io, the cloud and edge native messaging system.
https://nats.io
Apache License 2.0
15.99k stars 1.41k forks source link

publishing huge vloume of message on the same subject #5933

Open qiaohe opened 1 month ago

qiaohe commented 1 month ago

Observed behavior

when publishing huge vloume of maesage on the same subject . The messages received will got long latency (about 3minutes), Once publish on different dubjects, The performance will be improved. Any feeedbacks wil be appreciated. Thanks for your information in advance.

Expected behavior

The message will be delivered immediately

Server and client version

NATS 2.8.0

Host environment

16c 64G 3nodes

Steps to reproduce

nats publish message with 200000 meeage per seconds

derekcollison commented 1 month ago

Is this the correct server version?

Is this core NATS publishes?

qiaohe commented 1 month ago

Sorry just updated! Just use java client to publish the message

qiaohe commented 1 month ago

Different machines send messages to the same topic. this will be reproduced. want to know how to reslove this problems. Thanks

Jarema commented 1 month ago

Is the subject to which you're publishing to part of JetStream Stream?

btw, you are still using very old server. Please update to 2.10.20

neilalexander commented 1 month ago

Just use java client to publish the message

Are you using the NATS connection context to publish, or are you using the JetStream context? If you aren't using the JetStream context to publish to streams, you should be, otherwise you can overwhelm the server.

qiaohe commented 1 month ago

2.10.20

Thanks for your reply. upgrade to 2.10.20 to hava a try.

qiaohe commented 1 month ago

Just use java client to publish the message

Are you using the NATS connection context to publish, or are you using the JetStream context? If you aren't using the JetStream context to publish to streams, you should be, otherwise you can overwhelm the server.

I have not used jetstream version. Just found this issue will be occured when publishing messages from different machines. so far workaround solution is to publish messages from one connection context.

Jarema commented 1 month ago

@qiaohe so you were publishing messagse to a subject that is part of JetStream Stream using Core NATS publish?

qiaohe commented 1 month ago

so you were publishing messagse to a subject that is part of JetStream Stream using Core NATS publish?

I was publishing messages using core NTAS publish. this is not JetStream Stream version of NATS so far.

derekcollison commented 1 month ago

Try using the NATS cli and the bench command to test your system.

Which version of the Java client are you running?