All Episodes

Synadia Cloud Walkthrough: Connection Graph

Episode 102

Introduction to NATS Connections

NATS is really great at being able to have a lot of connections into the system, lots of clients, and have them be represented as various things, whether those are microservices or core infrastructure that you’re using or you’re using these as publishers and consumers for various streams, all of these come in the form of client connections. And so one of the things we wanted to do in Cenadia Cloud and Cenadia Platform is have a really nice way to visualize all of the connections that are connected into your particular account or your particular system. And so today, we’re going to be going over all of the features inside of the connections graph for Sanadia cloud and platform, and you can use all of that power to have a better pulse on your system health in general. So let’s take a look at first the group by functionality.

Exploring the Connections Graph

When you go to your account connections, you can actually kind of zoom in and out of this graph with the scroll bar on your mouse, which is great. And you could also drag around. And when I have one big amorphous blob of connections, it’s not really useful to kind of see just this. In fact, we wanna be able to kinda group these things a little bit more so we can kind of see what this is all looking like. And so, right now, by default, we group by nothing, but you can click into the drop down here, and you can group by things like account. Now when we’re inside of an account, this is just going to, you know, use our account. But inside of Cenadia platform or even in a custom system, you can actually look at a system wide level of connections and then group those by account, which can be really good for administrators trying to kinda get a hold or grasp on what account usage is looking like from a connection standpoint.

Grouping Connections by User

What’s more useful when we’re inside of an account is actually grouped by things like user. And so I can kind of see that, on my machine, orders, payments, and floor users is where a lot of my connections are kind of distributed, which is really, really nice. So I can kind of zoom in here a little bit maybe to my payments. I also have accounts down here as well.

Filtering Connections by Subscription

And I can click into one of these payment services. And, because we are on Cenadia Cloud, we don’t necessarily expose what server or cluster these connections belong to, but that’s okay because I can also kind of filter by many, many other things. Like, for instance, I know that this payment service twelve has a, subscription to accounts dot star. Now if I want to automatically filter by this subscription, I could simply click this little magnifying glass and that’s going to append, that subscription subject to, to that filter, which is really great.

And you could also see as I zoom out that there’s more services beyond just the payments user that are subscribed to that subject. In fact, we have order service over here. So I’m gonna click on order service In fact, we have order service over here. So I’m gonna click on order service six, and I can see that it has a subscription to accounts dot star and payments dot star.

Color-Coding Connections for Quick Insights

Moving on to our next section, we have the ability to also color our connections by a certain attribute. So by default, these are colored by RTT. So you can kind of see at a glance, oh, maybe there’s something that is, you know, having some issues with connectivity. They’ll kind of stand out, you know, pretty nicely.

So the the lighter the color is the the, you know, better the RTT or, you know, response time to the server, the round trip time.

But you could also see the ones that are darker might have some, you know, struggling, connections, quite possibly. But you can also color by a bunch of other things. I could color by their status. All of these connections are open, but I can also change the state down here in filters to say give me all of the connections.

And not only will it give me all the open connections, but it’ll also give me some of the previously closed connections. Like, I could see that stream viewer was, initiated and and closed at some point. And we probably don’t have any open stream viewers at this point because I don’t have any open tabs. But, you can change the state of the connection.

You can give all the closed ones, all the open ones. And as you could see, this is, really helpful, especially when you’re, you know, wanting to use color by.

I’m gonna go ahead and change the state back to just the open ones. And then we can go and do things like, hey. When did all of these start?

And, again, filtering down is really, really helpful here. I can see, you know, by the number of subscriptions. So back to our order service, we know that they have two subscriptions. So that could also be really, really helpful, you know, pinning down maybe problematic, connections, bytes pending, messages sent, or even last activity, which could be really, really nice for maybe some stale connections, tracking those ones down. And so, coloring by these can be really helpful just to add a glance, you know, find ones that really stand out. Oh, last, you know, last activity was was maybe a while ago for this one. So I’m gonna click into it and kinda see what’s going on.

Sorting Connections for Better Analysis

So, so that’s color by, but we can also take a lot of those attributes and sort by them. So we can sort by, you know, how long they’ve been up maybe, or we can even sort by, you know, how long they’ve been idle or how many messages have been sent. Let’s go ahead and say color by messages sent and sort by them. And you can see that the payment services are sending a lot of messages.

Account services are sending a bunch of messages. And all of these other ones, like machines and factory floor, they’re likely not sending any messages because they’re not publishers. They’re likely subscribed to things like the payments subject here. And so you can kind of get a lightweight overview of how your system is working just by kind of looking at this connection graph in general, which I think is really, really nice.

Advanced Filtering Techniques

So that covers kind of the sort by and color by functions of the account, connections graph. But you can also filter by various things, and we’ve been doing this throughout this whole video just by kinda clicking on those magnifying glasses. But you can also do them all manually here. You can kinda pull up the different users by those accounts.

You can, like I did before, you can change the state to all open or close. When you’re looking at this in the context of a custom system, you can filter by server or cluster, and you can even filter by the name of the connection. If you kind of know the name and you have hundreds of thousands of connections and you just wanna filter them down, that’s a really, really good way to go. The the last thing I kinda wanna share about the connections graph before we move on to the next video is that, all of these kind of, these attributes, these, different parameters that you can set here, it’s set inside of the URL.

Sharing and Saving Connection States

So if you want to go ahead and, you know, you get this to a a place that you like, maybe you wanna sort them by user, and I wanna just, like, filter all of them that have the, the payments subjects. And you could see that we have a couple here, orders and floor. Once I have this good to go, I can actually just open the URL that this is set to, and it has all of the, all of the parameters built into the URL. So if I wanted to share this with a coworker or things like that, I can simply just copy and paste this URL, and, I can, you know, visit this URL again to bring back up all of the state.

Live Data Monitoring of Connections

The other neat part about that, and you just kinda saw this change, is all this data is live. And so as you’re filtering this stuff, this is gonna be live data, and it refreshes, on an interval. And so, it’s really nice for just kinda keeping up at a dashboard and and seeing if there’s anything that kinda sticks out to you, monitoring connections of a new deployment, you know, seeing which ones are up or down or whether they’ve gone away. This can be just a really, really useful tool for, managing NATS connections in general.

Conclusion and Next Steps

So, I hope this video was helpful, kinda giving an overview on the connections graph, and we’ll move on to the next video which is all about managing Jetstream.