This is the first part of my labs project.
Today we are going to be going over what the second part of my labs project was and is a small description of what we've built on the second portion.
Once we filled the database with the bridges and villages data we noticed that it would take between 3.5 to 4 seconds to get the data, We needed a way to somehow improve the performance.
One of the solutions we came up with was to cache the data, and for that, we decided to go with Redis.
After we cached the data the performance increased by about 60% now taking between 100 to 200 milliseconds. Much faster right? To implement Redis it was actually quite easy. Here are some screenshots on how to implement it.
On line 79 we get the variable with the name bridges and a callback function with 2 parameters, after that, we check if the error is true it means we don't have anything store with the name of bridges.
Then on line 84, we check if data is true, it means we have it stored and we send that data.
If none of those conditions are met then we get to line 89 where we get the data from the database, send the data and then save it in Redis.
It was an amazing experience to have worked with an awesome team, I'm grateful to have the opportunity to work with them and I feel that we definitely did a great job. If you are wondering how the project looks like here it is.
website here
Top comments (0)