Serverless is a tricky term. Where did the servers go? Where does the code run?
Let’s clarify right away… yes, there are actual physical servers running somewhere when we use serverless infrastructure.
Serverless means we don’t have to manage those servers or pay for their continuous operation.
ServerlessWP works with Vercel, Netlify, or AWS. This is because they are all based on the AWS Lambda function as a service product.
Lambda functions only run when they are “doing work” like responding to a browser request. Behind the scenes AWS operates a huge fleet of servers so that the capacity to run all of the simultaneous functions is available. You get to take advantage of the ability of AWS to do this at a huge scale with their renowned performance and stability.
Serverless hosting is different than traditional hosting in a few beneficial ways for WordPress:
- Extremely low maintenance
- Lambda functions run in something called a micro virtual machine. The underlying operating system and runtime are maintained and kept up-to-date by AWS. You don’t have to protect a server from malicious access. You don’t have to patch and upgrade a server operating system.
- Pay per use
- ServerlessWP works with Vercel, Netlify, and AWS so their free tiers frequently cover all of the cost of a typical site. If you exceed that, you only pay for the amount of CPU time used by your site. You’re not paying for a server to wait 24/7 for requests.
- Autoscaling
- Huge traffic spike? Serverless platforms automatically scale up to handle hundreds or thousands of concurrent requests. To have that level of compute available with traditional hosting would require over-provisioning server resources and ultimately over-paying for what’s frequently needed. On the other hand they also scale to zero and don’t accumulate costs when traffic is low.
- Security
- Lambda functions are ephemeral. They only exist for a few seconds or at most an hour or so (warm functions are re-used when possible). This helps prevent persistent file inclusion vulnerabilities. They are also isolated. Your site code runs in a secure runtime that’s separate from any other site.
Let’s compare that to other ways of hosting WordPress:
- Can you pay per second of actual usage?
- Can it scale to handle thousands of requests per second without extra costs?
- Does it scale to 0 instances when there’s no traffic?
- Does it have the security of a microVM?
- Is a global content delivery network available to offload server usage and deliver content fast?
Serverless isn’t perfect though. You’ll still need to find a database and place to store your uploaded files because the short lived nature of the Lambda functions means your posts and user uploaded files.
ServerlessWP is a free and open-source project. Deploy a test site and give it a try!