Hosting
PWA on Lambda
Progressive Web Apps (or PWA in short) is a way of building web applications that was first proposed by Google engineers in 2015 and gained popularity over the following years as the web browsers implemented the standards required.
One of the main traits of a PWA is that it doesn't need to go to the server and fetch the entire page on each page the user navigates too. Once the initial page is loaded, all the subsequent pages loaded only require the PWA to fetch the new data it needs from the server, data that it also caches at the browser level for even faster responses on cached data.
The speed difference for the user is instantly visible and directly relates to increased conversions.
What is Server Side Rendering?
But when the first page is loaded by the user, for optimal speed, the server needs to render the page in its final format, just like the browser would. It is important that the initial HTML response contains the entire page rendered exactly as the browser would, so that the browser can display and style the page while the JS resources are still being loaded and display the page faster to the user. This part is called
Server Side Rendering
, or SSR for short.
Serverless Server Side Rendering with Lambda
Traditional hosting of PWAs would have a server running all the time and waiting for incoming requests. The downside with this approach is that the server needs to be large enough to serve a peak number of visits, which results in high costs; if the server is too small to handle peaks and can't scale fast enough, then visits during peak times will have increased load times or even timeout errors.
Zento is running the server side rendering on AWS Lambda, which is the serverless Functions-as-a-Service product by AWS. Serverless doesn't mean that there are no servers, but that those servers don't need to be managed, provisioned or paid by the customer. AWS provisions and scales the function as much as needed in order for all user requests to be served fast and payment is made for each execution of the function and is extremely affordable: for 1,000,000 executions of a Lambda (1024MB memory with 300ms execution time) the cost would be $6.67.
Since CloudFront is running in front of every SSR request, requests are also cached for a limited amount of time, which results in virtually no cost for those executions and 60ms response time, even during the busiest periods.
Security
Beside scaling and low costs, the Lambda runtime is also very secure, since functions are ran in read-only environments, so it's invulnerable to exploits that rely on altering the code of the function.
The function is also running in a private virtual network (VPC) to access other services (database or caching) for increased isolation and security.
Finally, all calls are protected by the AWS Web Application Firewall (WAF) that is attached to CloudFront so any attempts are detected and blocked and the Lambda function is also protected from DDoS (Distributed Denial of Service) and the less known EDoS (Economic Denial of Sustainability) attacks; this new type of attacks consists of flooding a site with traffic not with the goal of taking the site down, but with the goal of pumping up its cloud hosting costs.
Conclusion
By choosing Zento as your eCommerce solution, your PWA shop will have a fast, scalable, secure and cost effective Server Side Rendering, so that the shop is always fast for users without breaking the bank.