Identifiers aren't for scaling

(This is part of a larger series on scaling autonomous components. If you like, you can start at the beginning.)

We’ll wrap up the series on scaling today, with just one last word about the identifier parameter when starting a consumer.

We talked about how position stream names are formed. Eventide takes the category you’re subscribing to and appends the type modifier position. If you’ve supplied an identifier, that becomes the identifier portion of the position stream name.

So, if you consume the account category and did not supply an identifier, your position would start as account:position. This is exactly what the canonical [funds-transfer-component](https://github.com/eventide-examples/funds-transfer-component/blob/master/lib/funds_transfer_component/start.rb#L7) does.

Suppose you were going to extend this system and introduce overdraft detection. You’d very likely have another component that consumers the account category. That component would would also default to account:position as the position stream name. And here we have a problem.

Just like if your consumer group members can’t store their positions in the same stream because they’d potentially miss messages, completely different components can’t store their positions in the stream for the same reason. If you had an overdraft-component, you might start its consumer like:

Consumers::Account::Events.start('account', identifier: 'overdraft')

To sum this one up, identifier isn’t about scaling—it’s about telling things apart. Shocking, I know. To successfully horizontally scale, you happen to need to tell your instances apart, which is why you use the identifier parameter.

We’ll see you on Monday.


Like this message? I send out a short email each day to help software development leaders build organizations the deliver value. Join us!


Get the book!

Ready to learn how to build an autonomous, event-sourced microservices-based system? Practical Microservices is the hands-on guidance you've been looking for.

Roll up your sleeves and get ready to build Video Tutorials, the next-gen web-based learning platform. You'll build it as a collection of loosely-coupled autonomous services, developing a message store interface along the way.

When you're done, you'll be ready to contribute to microservices-based projects.

In ebook or in print.