# Bot makers: what is more stable? One IRC client per user of the bot or one big IRC client?

**URL:** <https://discuss.dev.twitch.com/t/bot-makers-what-is-more-stable-one-irc-client-per-user-of-the-bot-or-one-big-irc-client/7011>\
**Category:** Chat and IRC\
**Created:** [July 30, 2016, 9:38am UTC](https://discuss.dev.twitch.com/t/bot-makers-what-is-more-stable-one-irc-client-per-user-of-the-bot-or-one-big-irc-client/7011 "2016-07-30T09:38:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![adamstel](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/adamstel/32/1931_2.png) [@adamstel](https://discuss.dev.twitch.com/u/adamstel)\
**Post date:** [July 30, 2016, 9:38am UTC](https://discuss.dev.twitch.com/t/bot-makers-what-is-more-stable-one-irc-client-per-user-of-the-bot-or-one-big-irc-client/7011/1 "2016-07-30T09:38:38Z")

</div>

I’m relatively new to developing twitch bots but I have a stable bot that I’m beginning to re-architect now that I’ve seen some of the limitations of my current code. It’s a hosted bot and at peak times I only have ~50 users using it.

My current design has a single IRC client per channel my bot joins and I’m curious if anyone has experience doing it this way vs one IRC client serving up multiple channels simultaneously. I don’t know if one may tend to be more stable long-term or not; obviously if my bot somehow got thousands of users one IRC client per user would be bad, but at a scale of only around 50 people does it really matter which approach I choose?

For reference, my bot is incredibly specialized so I doubt I’ll see its peak use grow that much. It’s a bot that tracks a Destiny game mode (Trials of Osiris).

Any thoughts on the matter would be appreciated. For the huge hosted bots (moo, night, etc) I have to assume they have one IRC client performing IRC duties for their users (or a farm of machines each serving up a set of users).

Another question: are rate limits per _connection_ to the IRC chat, or are they per twitch account you’ve connected to the chat with? For example, if I connect to 50 different rooms with my bot account, each using a separate IRC client, am I rate limited across all 50 or is each one separate?

---

<div class="post-metadata">

**Author:** ![3ventic](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/3ventic/32/298_2.png) [@3ventic](https://discuss.dev.twitch.com/u/3ventic)\
**Post date:** [July 30, 2016, 10:05am UTC](https://discuss.dev.twitch.com/t/bot-makers-what-is-more-stable-one-irc-client-per-user-of-the-bot-or-one-big-irc-client/7011/2 "2016-07-30T10:05:25Z")

</div>

The large bots spread channels over multiple connections. It’s not one channel per connection, it’s more along the lines of 20-50 channels per connection.

A single channel per connection is not viable for huge bots. Each outgoing connection takes up a port and it’s a huge waste of resources, since the vast majority of the channels will be dead silent as well.

Everything on a single connection is bad, because if the connection drops, you need to join all those thousands, even tens of thousands of channels again, and that will take hours, possibly over a day.

So what you’re left with is a hybrid. You don’t spend a huge amount of resources and, if a connection drops, you’re not spending an eternity getting back up again. The downside? The code gets complicated.

---

<div class="post-metadata">

**Author:** ![adamstel](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/adamstel/32/1931_2.png) [@adamstel](https://discuss.dev.twitch.com/u/adamstel)\
**Post date:** [July 30, 2016, 7:27pm UTC](https://discuss.dev.twitch.com/t/bot-makers-what-is-more-stable-one-irc-client-per-user-of-the-bot-or-one-big-irc-client/7011/3 "2016-07-30T19:27:48Z")

</div>

Thanks. That’s pretty much what I figured and is the route I’ve drawn on my whiteboard. It’s also not something I’m looking forward to doing, so I may just keep 1 channel per connection until last 🙂

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [August 29, 2016, 7:27pm UTC](https://discuss.dev.twitch.com/t/bot-makers-what-is-more-stable-one-irc-client-per-user-of-the-bot-or-one-big-irc-client/7011/4 "2016-08-29T19:27:51Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
