Conf42 Cloud Native 2024 - Online

Unlock the Power of Serverless Computing with Cloud Functions

Abstract

As a speaker, I will:

  • Introduce the concept of serverless computing and explain its benefits.
  • Discussing the features of Cloud Functions and how to use it to build and deploy serverless applications.
  • Sharing best practices for building and deploying serverless applications.

Summary

  • Today we will see the power of serverless computing with cloud functions. It's cost effective, scalable, time saving, event driven and cloud agnostic. Here are some of the best use cases.
  • Neil: As a security person we should also consider security as one of the core major things, optimizing cloud function performance. How to optimize them, because when cloud starts and strategies are not there, it could break the like. Neil: Here are the different techniques you can use and you can also customize the thing.

Transcript

This transcript was autogenerated. To make changes, submit a PR.
Everyone welcome to comforted to cloud native. Today we will see the power of serverless computing with cloud functions. This is Nielsha at Evox Community Guy building various DevOps communities like Google, Cloud, NCS, Docker, Hashico Bank. I build a 15 plus hackathon and I help people, more than a thousand plus people to to the source. Let's understand what is serverless computing? Serverless computing in a layman language is execution model where your infrastructure will be scaled and maintained by the service provider. You just need to set up the small infra, it will automatically scale infrastructure by the service provider. This is just a definition for handling. So let's shift from the traditional model where we were giving a lot of time to scale our infrastructure when the user, when the traffic is more. So let's focus on the core things apart from working on the scalability. It takes a lot of time. So why do we waste our time? So let's shift what are the advantages of serverless canvas? It is cost effective. When you have lesser traffic, you have a smaller consumption, the cost would be small. When you have a higher traffic, the consumption will be higher, it will have a higher cost, so it fluctuates. Next is scalability. So when the traffic has raised it will automatically scale up your product and it will trigger that, to scale up that scale up your application. And the next thing is focus on code, not on the infrastructure. Eventually we do a lot of things to maintain our infrastructure in a very good position. We do scale, we do monitor scaling. Purpose installed by it. Next is the evolution of serverless 1800. Let's say sorry ninety s to the era of physical machine and there were a huge computer, there were huge OS, it was utilized. Then it came an era of virtualization where VMware and all the companies partitioned from the OS and utilized two different things on the same computer. Then came the era of cloud computing where people are storing their data on cloud and hosting their applications on cloud. Then came container, try to automate and try to containerize everything and have shifted to microservices and all the people are shifted to serverless. As serverless is everywhere. All the big cloud provider are providing their serverless services. As some of the companies utilize it in a better way. You don't need to take care about the infra besides service provider do that. Next is what are the key concept. So it's eventive execution, automatic scaling and paper execution. So let's discuss what was event driven. Event driven is if something is changed in your code or if some event has occurred. So after that event made call some of the function or some other thing then this sort of thing is called event driven execution. Next is automatic sharing as I already told and paper exhibition be only what you own with serverless. Serverless people will say why serverless? So there are the major reasons. It's cost effective, scalable, time saving, event driven model computing to cloud functions the cloud functions is a serverless service provided by ECP. That's Google cloud platform and it offers all the things which we discussing until now also cloud agnostic. Language agnostic. Why I say language agnostic because it allows various languages like node, Js, Python, Joe, Java, net and nowadays UV also to write their serverless function code in these languages. We will see all the things in a demo later on. What are the use cases? Here are some of the best use cases. People are utilizing in two ways are enough that is bad hook and API integration. Let's take one example, simple example, if we had integrated Jenkins, if we had deploying another deploying failed, then there would be alerts and apparently alerts. If we want to call some other function which will redeploy that by sharing something, then we can do that with cloud function. Next is real time beta processing. Let's take an example of a live cricket match, football, basketball match, anything. And the application owner would be showcasing some, let's say like a game or poll on the screen and from the data of that the admin, the owner of the application would trigger something because he will ask which team will win. Or let's say if the match was interesting or something. So the answers of the users it will change something and make if this match was liked by many people then it will have that in the first order. So these are small things which can be implemented with real time. Next is image and video processing. So for this when we store images and videos in cloud, it gathers a lot of storage. It needs a lot of storage, so why not we optimize them? Let's say we need to just store the image in the minimum format of two MB and store them. So if anyone has uploading that photo in our application, then we can trigger this and customize the size of the photo to two MB. So this way it will work. Next is microservice architecture. So how does it work? When we have our whole application, we try to modularize them to break them in smaller parts. So in microservices it can help to easily automate the things. Next is integrating with third party service API. You can just see this is normal example where we are pushing some comments on GitHub, the GitHub webhook that's a third party API integration on the cloud platform. So the webhook will trigger with cloud functions and it will trigger to slack. So there is two third party apps and the intervention of them is done by the cloud function. This way it cloud also helpful for us next is serverless mobile backend. So as I already told you an example of preclaired or basketball game. So similarly as something is live from the answers and from the responses of user, the owner of the application knows which thing is better and how to trigger them. The application could boost about have more user. So this way the serverless functions are helpful for it. So serverless I have to back in. Nowadays the home automation thing is on boom. Everyone is utilizing their smartphones to spin up their span, spin up their lives, everything there. Also this function intervention would help them. So let's see the sensor how it works. So when the temperature doesn't have directly temperature sensor but eventually from coding perspective we can utilize the function to integrate the two third party sensors and have the automation in IoT directly. So it plays a good role in IoT. So yeah the thing which I told you directly so you had a good length of video and then if someone is uploading the video on your application then you can figure out how much storage or something should be done on the video and just store them in the cloud storage. So it will be to basically help you to optimize your storage. It will eventually help you to optimize the cost. Some of the best practices for cloud functions are design state lab functions. State lab means independent functions which are not dependent because sometimes what happens is one function is triggered on the cloud function and other dependent other function is dependent on that. So it will wait till the first function is triggered. So if first function goes out the next function won't be able to do its work recurrently. Try to use states like design state lens function. Next is handling dependency efficiently to minimize the dependency, to minimize the parameter library package sort of thing. Use lightweight libraries so it will help you to boost your efficiency and to boost your time. Next is setting up monitoring and logging. Eventually it is a good way to monitor and log because sometime you need to have the minimum storage or some sort of thing. You have a minimum bandwidth. So how you will decide that so something is some thing has gone up above your bandwidth then you should be notified securing function code and dependencies. So even if you are utilizing third party libraries then you should have a least privilege with them. Because sometimes if I use a third party library and it has security concerns, security vulnerabilities, and I had it bigger in my live project and the whole thing will be gone to have security scan before that and also to give them least access, least privileges. So it will be benefits for us because as a security person we should also, sorry, as an infrastructure person we should also consider security as one of the core major things, optimizing cloud function performance. So cloud starts involved strategies. So sometime what happens is the serverless function is working on a low end, low end is minimum end, it is going at minimum. And from almost one month and something, some huge traffic has came as some good sale is there in Amazon or something, then a huge traffic will be there. So how to optimize them, because when cloud starts and strategies are not there, it could break the like in this technique, what you can do is every day takes a time where you are infecting a traffic, good traffic, or every month, every monthly or every weekly you can figure out as per your perspective. So it will help you to optimize your function whenever it is in need. Next is minimizing function execution time. So it is really important to optimize them because we need to try and test them. How we can get the idea, let's take the execution time of function is 10 seconds and we are figuring that we have figured 16 seconds, so it is not a good use case. How we will figure that we need to test drive and then we can figure it out. Next is fine tuning of time out of values. It's same as inner keys with the execution time. But yeah, we need to figure out that ensuring security in cloud functions, so security is also main concern in each and every aspect. So utilizing IAM rules and giving the minimum privileges to the app. Next is securing function code dependencies. So try to avoid giving your password, your passcodes or app codes and your functions and store them some other parallel, some other way. We have key management systems in every cloud provider and some of the projects we use vault also to store our secrets. So yeah, try to utilize the various secret tools handling consider data and script all the data. And also there are many services by the Google provider so you can use them. This is the shift which is there. So firstly, how human has shifted as a human from the animal sort of thing, the physical, virtual, virtual continuous. Then came the serverless. So you can understand the whole thing, whole economic specs like diplomacy. I have made good resources for all the cloud people. You can do visit this on GitHub and it's public, you can utilize the good resources. You can connect me tag with me for inquiring and now we will go ahead for the demo. So yeah I already made the demo. So go on to Google Cloud, search for power functions and then create functions. You can write the name, you can then select the region. Google Cloud also supports to reduce the carbon footprint so it is showing low carbon in that. And here are the types, these are the HTTP curbserve cloud storage firestore so if something so if something HTTPs requests are there then it will be good. The password is public and subscribe. They are the different techniques you can use and you can also customize the thing. So these are the allocated and then you can set all the things. You can also set how many instance you want for auto scaling. These are the all things you can figure out once when you are on the cloud function. After making the cloud function you can see you can select many languages over here you have python node react and. Net java all the over here I'll choose python over here and we have your HTTP request over here. We can upload the file from local from the cloud storage and we can also edit the file over here seen on the right hand side we will customize and you can test the function over here. The name is given in hello. We will just check them and change, try to change that. It will take one or two minutes. Cloud that now I have changed hello world to my name and it should work perfectly. See the function is ready to test. Functions is ready. Yeah that can be on both the things here also and on the console also. Hello Neil it's there. You can try and figure out you can connect with me.
...

Neel Shah

Product Manager @ Internauts Infotech

Neel Shah's LinkedIn account Neel Shah's twitter account



Awesome tech events for

Priority access to all content

Video hallway track

Community chat

Exclusive promotions and giveaways