The Importance of Concurrency
So far, we've seen how to use concurrency to split the work over several Goroutines, but in all these exercises concurrency was not really needed. In fact, you do not save much time doing what we did, nor do you have any other advantage. Concurrency is important when you need to perform several tasks that are logically independent from each other, and the easiest case to understand is a web server. You saw in Chapter 15, HTTP Servers, that several clients will most likely connect to the same server and all these connections will result in the server performing some actions. Also, these actions are all independent; that's where concurrency is important, as you do not want one of your users to have to wait for all the other HTTP requests to be completed before their request gets handled. Another case for concurrency is when you have different data sources to gather data and you can actually gather that data in different routines and combine the...