what are its functions and how are they different than serverless functions that's one of the questions i get asked the most so in this video i'm going to do my best to explain you what its functions are and what's the difference between them and serverless functions before we can understand its functions we first need to understand what serverless functions are simply put serverless functions are functions that are run in the cloud so basically you can define a function put that function in the cloud and then call that function with a url there are many places
you can place your functions in for example with abs you have abs lambda and with azure you have azure functions another way you might already be using serverless functions is with version and nextjs api routes and that's because nextgs api routes are actually run as serverless functions so with nexus api routes when you deploy your application reversal and after that make a request to your api route there is not a traditional web server running 24 7 waiting for you to call that function the function is actually started and executed independently when you make the request
i know this can be a little bit hard to wrap your head around and to be honest i don't either fully understand everything that goes goes down behind the scenes but i think the most important part is that we understand the basic principle behind that logic and behind serverless functions advantages of using serverless functions compared to traditional web servers or virtual machines is that you only pay when the function is executed and not for the uptime of the server another advantage is that several functions are easier to scale and that's thanks to the fact that
you can just spin up more instances of them easily when you need them instead of setting up new servers one of the biggest disadvantages of serverless functions is the possible slow startup times this happens when a serverless function needs to do so called cold start and call starts happen when a server's function is not used frequently and a service provider for example versus needs to spin up a new serverless instance from scratch and that takes some time another disadvantage is high latency so serverless functions are executed in the data center where they are deployed to
so for example if you deploy your function to a server in san francisco and someone from new delhi calls that function the geographical distance between the client and the server is so long that it will take some time for the request to travel from new delhi to san francisco and then back to new delhi and in these kind of cases the latency will be higher so in conclusion serverless functions are executed in the cloud on an as needed basis advantages are pricing and that they are easier to scale than traditional web servers these advantages are
possible slow startup times and high latency thanks to the fact that users need to connect to the data center or server that the function was deployed to and this can be in the worst cases on the other side of the world so what are then its functions well in short they are serverless functions with just couple of differences the number one difference is the location that the function is deployed to as we learned about serverless functions they are deployed to a single data center or server and whenever someone wants to execute that function they need
to connect to that single data center with its functions this is different its functions are not deployed just to one server but they are deployed to multiple servers that are geographically located around the world this is also where the name itch comes from because the functions are deployed to the edges of the internet so when a client wants to execute a function it doesn't have to connect to a server on the other side of the world but instead it will be routed to the nearest server that the function is deployed to this reduces the geographical
distance that the request needs to travel and that way also decreases the latency another difference is that edge functions use a different runtime than serverless functions serverless functions can use multiple runtimes depending on the service provider but at least virtual its functions use the google's v8 javascript and web assembly engine and this means that there is a limited set of apis inside of its functions that you can use so in conclusion when we are talking about its functions we are basically talking about serverless functions that live on the edge in order to have our functions
on the its we need to have this its network and infrastructure in place and this is something that the service providers like virtual or netlify provide at this point i want to thank datacms for sponsoring this week's video data cms is very user and developer friendly headless cms it pairs super well with nexus and it's easy to use their craftql api fetch content from the cms to your next.js applications data cms also has worldwide cdn which means that your content images and videos all live on the edge and as we just learned about the itch
architecture having your content on the edge means low latency and that your users will get their content super fast i highly recommend that you check and try out data cms i have a couple of videos that will get you started with next.js and datacms so i'll be sure to leave a link to those down in the description thank you again datacms for sponsoring this video personally i think the edge is coming more and more popular and i think it's one of those things that every web developer who cares about user experience and performance should know
about so to learn more watch this video over here next