matryer / goblueprints

Source code for Go Programming Blueprints
1.44k stars 358 forks source link

Will it scale? Iterating over clients #51

Open thalesfsp opened 7 years ago

thalesfsp commented 7 years ago

In room.go line 58, what happens if you have 1Mi users?

matryer commented 7 years ago

You can’t horizontally scale this solution, so for gigantic scale you might want to distribute the messages over a messaging queue. But I am very interested in how well Go does with a million users. Another option might be to send the message to the client in a goroutine so it doesn’t wait before sending the next one.

I think the right approach to this kind of problem is to build it simply first, and play with it, test it, benchmark etc. to see if it’s fit for purpose. Most projects won’t get a million users, so there’s no point investing the time building it up for that kind of scale. For those lucky projects that do reach that level of success, you won’t mind rearchitecting pieces of the solution if you have to.

On 3 Jul 2017, at 17:50, Thales Pinheiro notifications@github.com wrote:

In room.go line 58, what happens if you have 1Mi users?

https://github.com/matryer/goblueprints/blob/master/chapter1/chat/room.go#L58 https://github.com/matryer/goblueprints/blob/master/chapter1/chat/room.go#L58 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/matryer/goblueprints/issues/51, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGNG5qfzxrFOmtDODICXpDd6z2RNIqcks5sKX5IgaJpZM4OMwuX.