What is a replica in Quix?

So my thinking is a replica is a clone of a microservice process. For example, let’s say I create a project called “MySourceConnector” and I deploy it, by default there will be a single instance of this code running (one replica is the default).

If, however, I configure the deployment to have two replicas, I will get two copies of the exact code (that is, two identical processes) running at the same time on the infrastructure.

So, with two replicas, I have two copies of the same code running. Now, if I have specified a consumer group in my source code, these two replicas (processes) will be running in the same consumer group (the one I specified).

But, if I don’t specify a consumer group in my code, then each replica will not be in a consumer group, which is the same thing in effect as them being in different consumer groups to each other, or putting it another way, they would effectively each be in their own consumer group.

Have I understood this correctly? Thanks!

1 Like

That is correct Tony.

To sum it up:

A replica is a running instance of your application built from your source code. When you have a consumer group configured, they all will use the same1, sharing load according to Kafka’s load balancing2. If you are not using consumer groups or use a random generated, they will read all messages according to other configurations (such as auto offset reset).

If you’re not using Kafka, but an API, you can still run multiple instances and they would load balance the incoming requests between each-other.

1 assuming you’re not implementing some random logic. I’m assuming all your replicas use same env value or hard-coded value.
2 If you have more replicas than partition, some of the replicas will not have any assigned and will be idle. We have warning about this at several places, to ensure you don’t waste resources, but don’t block you from doing it. You might have a valid reason for doing it that we’re not aware.

1 Like