Performance in Cloud Times
Disclaimer — All the text included in this articule covers my experience with cloud in the last 6 years.
The current age that we are living is under the hood of big companies like AWS, Azure, GCP among other offering similar services with a lowest cost. As developers this is like haven , we do not need to worry about the servers that we have, if we just switch the cloud properly it will pick the resources on a dynamic way just to use the proper resources on peak time. This sounds nice and it is wiping out a layer of any architecture which is DevOPS , because technically we just put a credit card and we select the options in our cloud.
All of this sounds really nice we as a team can handle a full architecture with a big and scalable application that works among several users in peak hours like charm.
There is a cost on this and it will be reflected in terms of cost, if you are working for a big company they will probably not even notice, but if you are working for a company that every cent counts in revenue, it means that your work is in risk and if you do code without consider certain key elements , you are going to kill a company eventually.
There are certain elements that you may need to consider when working in cloud :
- The workflow of the application — This needs to be build in a really smart way at high level . In example if the homepage opens by default a list of widgets to show significant data , we need to consider how many server resources will be used in there.
- SQL — The developer usually answer yes , when they are being asked if they know how to build SQL , but it does not mean that they are considering all the internal rules to get the best performance , if we have a peak hour in our app and from the very beginning we display information from the database , we are going to have a bottleneck and cause a high peak in terms of server resources.
- Cache — This is a really good element that can be used across our app but it needs to be used in a proper smart way , if you put everything in cache eventually it will cause a high cost in terms of performance.
- Stack — you need to check the pros/cons on all the stack that you are using, you can build something with the top at frontend level and backend level , but if you pick a database design in a not smart way , you may get a bottleneck in there. This scenario can also be considered on the frontend or backend…
This means that we need to be really careful on every phase of the development under cloud, if you are in architecture side, you need to consider the elements that can be stored in cache and check the feasibility in terms of the stack to be used.
This will give us a chance to be aware if the architecture was specified in a smart way , if it gives us as result that we will be using a bunch of memory due to the cached elements, it means that the workflow needs to be redesigned in a different way.
The SQL side can be tricky because you need to check exactly what can be saved under cache, what can be used under dirty reads and finally what exactly needs to be outside of the dirty reads. This needs to be defined just after the architecture is being defined because it will give us a small window to review if the workflow of the app needs to be updated on a different way.
At this point 0 lines of code were written and we already have an ‘eagle view’ of all the key elements that needs to be specified and we also have some quick communication with the business to define the workflow of the application and considering the amount of resources that will be used by our app using a cloud service.
The stack , let’s asume that our user is working with React , we can have a front-end engineer working with it but it is not just about type the needed js/jsx/jst in order to create a pretty UI , there are bugs in the library that needs to be considered in the build and we also need to ensure that all the code is being typed in order to look for a good performance level on the front-end. This list of rules applies also to the back-end level , you can have a backend engineer with enough experience to build an app from scratch but the code needs to be looking for a low big(o) value and that’s just the beginning , the code also needs to be easy to read/maintain and last but not least, all the transactions executed needs to have a proper level of security.
The security is as important as the whole flow , but this can be a full articule with real nightmare stories about what you can live if you are not aware of how important this is.