- It is important to think about hardware and software performance when starting to code.
- In the old days you had to worry about physical servers but thanks to cloud hosting sites like Amazon Web Services, Google Cloud Platform, and Microsoft Azure we an run all our software on computers/data-centers owned by huge companies.
- Back-end infrastructure is an integral part of any project, and should often be started first!
- Containers (Docker/Kubernetes) are becoming more integral when creating back-end infrastructure and self sustaining deployment pipelines.
When anybody begins coding for the first time, there is nothing more satisfying than running the code and seeing all your hard work function correctly. Once it is done that's it right? Add it to wherever you need to and you are done with the project? Well in the case of an app such as VyB there are a few things that you may have to keep in mind hidden under all that excitement.
Coming from a hardware background I was always fascinated by the processing power of modern computers especially in a data-center environment. Rows upon rows of infinite compute power right? Well unfortunately when you are looking into putting an app on these servers there is a lot to consider. AWS (Amazon Web Services) is a cloud computing platform that is used by thousands of applications. With all these processes running on these servers they charge for the use of these servers by the number of executions of your code and the amount of data your code actually uses/produces. Now that 3000 element array called “temp” in your script doesn't quite seem as important as it used to.
In a situation like VyB’s where cloud computing is the most practical option, efficient code is a must. Now you might say to yourself “well to avoid these fee’s we can just do all the calculations on the users phones, right?” but the processing power of a cell phone compared to that of a enterprise level server is like comparing an eighteen wheeler to a smart car. We do not want the phone slowing down while the user is trying to use our application. So the best we can do is make our code as efficient as possible. Small changes such as removing nested for loops can drastically shorten the run-time of a piece of code. These small changes add up to quite a bit of time and data saved.
Running inefficient code maybe once a day may not seem like that terrible of a mistake but in a situation such as VyB’s, this can lead to massive resource usage. The biggest problem with this is scaling. When an application such as VyB is brought to the user base of thousand/millions the number of these code executions exponentially increases. When all of these invocations are being run on a remote server this can dramatically increase the amount of data and resources that we are using which can add up to massive costs very quickly.
Scaling, and more importantly active scaling is one of the most important aspects when an application is being opened to the public. Overnight a user base can drastically increase and being prepared on the back end is a must. AWS luckily is looking out for developers and makes use of a new technology called containers. A container is a closed off environment (basically a mini computer) that runs inside of a server to deploy code and then removes itself once the code has completed. This way resources on the server side can be very well managed with active notice to traffic. When there is a spike in usage such as 1000 new users the server will automatically build new instances of these containers to help dynamically adjust for this spike in users.
Back-end infrastructure is an integral part of creating an application so always keep in mind while coding “what impact will this have on the servers I will be running this on”.