Build an App Infrastructure using sustainable tools
Today, we have an interesting topic about software development. Building an App Infrastructure using sustainable tools. And by this, I mean, what are the best options based on your Application you’d like to build, and how you surely know these are the best possible options.
I will try to stay focused on the infrastructure more, because this can affect a lot the performance of your App, as well as the system sustainability (and your “pocket” as well 😉 )
IaaS, PaaS, or SaaS?
If you don’t know yet what these acronyms are, let’s make a short introduction. All the systems are divided in these 3 main categories, IaaS (Infrastructure as a Service), PaaS (Platform as a Service), and SaaS (Software as a Service). The last couple of years, because of the huge cloud growth, you can find more than these ones, especially in academic papers, but for now let’s stay in these 3.
Your PC is let’s say a IaaS, as you have the administration to do everything. In a cloud computing manner IaaS is the Virtual Box, KVM, and in general all the VMs you are able to run in a Cloud machine. In these cases, you have all the admin rights to set it up as you prefer. Your website hosting in most cases is in a PaaS system as someone else is the admin of your system, and you just use some tools in it (Plesk for example). Finally SaaS is for example the Canva app, which is an online tool to create presentations and more. There, you have admin rights only for your account, but you cannot manage anything on the platform.
Which one(s) are the best for your App infrastructure depends on the purpose of the App, and the requirements behind it. But let’s move into a case I had, and how I managed to have the best possible option for my App.
My first setup
Ok, for those who have experience might not be the best setup, but let me first introduce the reasons of my decisions.
In my application the important tech stack and requirements were 1) huge capacity for photos (but also not so costly), 2) a backend in Java spring boot, a simple database, and a frontend which is on React language.
I decided to go with Heroku, to use my already PaaS hosting for frontend and database, and of course to choose google cloud storage for Photos, as it has a very good pricing per GB, and also it provides some extra features like cold line storage etc.
Maria, Heroku is Pricey for heavy BE
Well, yes.. Heroku has some amazing pricing plans and additional features like monitoring, stats etc, but in general, Heroku is a good fit for those who don’t want to spend time for setting up monitoring like prometheus, or for a simple app running on production. In my case, my Backend was heavy for the lower plans that Heroku provides (which are value for money), and I ended up choosing a plan which was way too expensive, and even more expensive than a VPS hosting (IaaS).
Maria, you didn't think of network...
Nobody is this earth can think from the beginning everything! Of course I totally “ignored” the network traffic and the response times between the instances. In my case, the connection of backend and database was a bit slow, as first, I don’t know where Heroku hosting location was, and secondly Database sources might be less, as it located in a PaaS hosting, and thus I don’t have so much information on what when and why.
Let's re set up
As I mentioned before “..I ended up choosing a plan.. even more expensive than a VPS..“. Well, that triggered me. VPS is actually an IaaS system, in which you have grant access to make everything you want. So it was a win-win if I could find a VPS plan right on my pricing criteria.
Of course I found not just a VPS with better price than Heroku, but also with more resources (RAM and vCores), and as a result this will help me a lot to set up more things on this machine (monitoring system, mail servers, and other stuff I might like in the future).
Google Cloud storage was kept as is, because it was indeed a value for money option to store a lot of GBs. The way it manages the files with storage classes, it indeed does not waste energy 🌱 and resources when it’s not needed.
Backend – database connection now is of course better, and even the whole app performance is going better, as the Backend has more resources in case it needs it.
And what about sustainability Maria?
In this article, I mentioned “sustainability”. There is of course a reason for that. Sustainability is not just spending less resources. In my case, I thought that if I use my existing systems and adding some additional ones, I will have a Sustainable system. Well, no. To be able to have a sustainable system, you need to think twice for the way you are going to build your instances. If they having good network connection, if they have the resources needed, if they exceed their resources or not. I take as granted that your code in your application is performant and also well written.
For my case, my first selections were bad for my ‘pocket’, bad for my clients’ needs, and in the end bad for sustainability. The app was expensive, it was not responding well enough, it had restarts, the cpu usage was at 100%, and thus more expensive, and all these factors affected everything in my App.
So, the conclusion is: Note everything and experiment! Think first for your application’s needs, think for your users/clients needs, but try it. Try to note what you already know, what you can take as granted, but if you don’t try, then you are not sure what will happen.
I hope that you liked this article! If you have any question or anything you might want to mention, feel free to contact me!
Talk to you soon! Till then bye!! 🙂