Hey,
I come from JS and I never heard the word Concurrency before…
I am lost because I don’t understand Concurrency, I don’t know when I have to use it too.
I have already looked at golang tour and go by examples but…
I use go to build HTTP Server,
Can anyone explain me please ?
Yes. This is nothing different in Node, Ruby, PHP.
When you do not do concurrency, then you can not do 2 things at a time.
But to be honest, when you just want to create a website using Go, you do not need to worry about concurrency and channels yet.
All you need to know is, that you can handle the request in your handler, and dealing with many requests concurrently is abstracted away from you.
As long as your database is the only source of shared data and you do not use shared variables, you won’t even notice that you are handling the requests concurrently.
All go http handler methods are already goroutines, so you don’t have to worry about multiple requests. You maybe need your goroutines in some cases, but you can start without.
For example you want to scrape some websites in parallel or ferch some RSS, this is first that came to my mind but there are so many possibilities. Simply, when you want something to be done concurrently or parallel.