Adding Concurrency to our Web App – Go Lang Practical Programming Tutorial p.24

Welcome to part 24 of the Go Programming tutorial series. In this tutorial, we’re going to be applying goroutines and channels in an effort to add concurrency and more efficiency to our web app.

Text tutorials and sample code:


Yt3912487 says:

great tutorial series!

We Rate Bikes says:

if you don’t load every page up front, will the Search field only find terms on that loaded page?

Ehsaan Asghar says:

Hi, im doing a project which involves coding using a raspberry pi. And i am outputin a cars data onto a screen which will help the driver, i was wondering if you could give me some tips and some help.
Would be much appreciated as this is my final project at university.

Abeltensor says:

The code is a little messy but the only way I can think of to actually increase performance would be to build this without using wait groups and to change the way the front end works.

So basically as far as the wait groups goes, you have this extra part that has to fire before the code starts to sync up, but you can naturally use go routines to handle syncing in 99% of cases if you write your code properly. Unfortunately, I don’t have the time right now to sit down and write a version with out wait groups, maybe later.

Also the template is unpacking the NewsAggPage struct which could be done better in the back end to get a little more speed.

Lets just say that If i was going to rewrite this code, I would probably use a map to store the incoming data and then I would be able to access that data directly with out having to iterate through it on the template.

Dark says:

Why do we have to wait for all goroutine until we can check the chanel? Normaly I would think, we only have to wait for the first routine to finish and then we can get the first chanel value. Could we sync this too? In theory the handeling of the data could cost expensive time and we would start some new goroutines with the handeling while some old goroutines are wating for the data to come in.

Sukhrab Ayupov says:

Do you have Data analysis (Pandas, Finance etc) tutorials in pdf format? I spend a good amount of time on the subway every day so would greatly appreciate to have something that I can access offline.

japrogramer says:

Since the weight group is global, wouldn’t you end up waiting for other requests to finish to send one if more than one happened before the wg was empty for previous request ?

9Y0 says:

6:52 you know how many locations you have since they are all stored in the s variable. isn’t it better to get te size of the locations and pass that number to the channel?

easyBob100 says:

For speed, I’d recommend loading the data once every minute or so on the back end. I don’t like the idea of loading the data from the WP every time a user visits your page….you’ll be making A LOT of requests to their site. This of course works even better for things that don’t change as fast either.

bajro lisić says:

Brother this channel become better and better I would like to see in future database manipulation (probably mongodb) and also websockets

George Grunwald says:

Thank you for all of these videos. This channel is full of useful information.

Tomas Evergardenas says:

Best tutorials on go lang! Thank you for these. I would love a tutorial about sql or nosql database. How to connect, fetch results and so on.

 Write a comment


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!