Relative Content

Tag Archive for nats.ionats-jetstream

Getting error “consumer is already bound to a subscription” while subscribing to the nats second topic

I have created two streams on my nats-server, using nats cli. Then using nats-io/nats.c library, I created two consumers for each of the streams. now I am trying to subscribe to the topics in each of the stream, I am able to successfully subscribe to only first topic but unable to subscribe to second one, as its providing me the error: consumer is already bound to a subscription. for first topic subscription option I am using consumer1 and for second topic I am using consumer2.
Things I did

NATS Micro – NATS JetStream Cluster – High Response time

Finally I have created 4 services out of all (which could reach around 13 to 14) using NATS micro package, is is amazing , however I am facing a bit high response time so sometime the edge service which receiving request getting NATS timeout error, I have increased the timeout in that service up to 10 seconds but still , I am using Jetstream cluster and tag :latest in k8s environment , my machine is pretty powerful, M2 Max with 96GB memory, I have increased the number of NATS instance so now I have a cluster of 10 nodes, but still I am getting timeout, the system that I am working on it high response is causing problem, it is for Telecom product working with Diameter protocol, without NATS average response time is about 0.2 milliseconds, when I have NATS it reaches 1.1 and sometimes 2 seconds, the gateways service is listening for diameter message and forward it to some other service for processing, and the process service need to query the database (redis-cluster) via repo-service and the repo-service and the processor-service are exchanging information, repo-service is Respond with JSON I am thinking of change the response to []bytes instead and that could decrease the response time, but I am not sure,
Q1- Should I use Jeststream for microservice ? or should I use NATS core only ?
Q2- Is there specific configuration where it can make it faster ?
Q3- Does Respond in none JSON format is faster than JSON one ?
Q4- What is your advise please ?