Need advice about which tool to choose?Ask the StackShare community!
Apex vs Serverless: What are the differences?
- Execution Environment: Apex runs on the Salesforce platform, which provides a dedicated environment for executing code, while Serverless functions are executed in ephemeral containers that are spun up on-demand by cloud providers like AWS or Azure.
- Scalability: Apex relies on the resources available within the Salesforce environment for scalability, while Serverless scales automatically based on demand without the need for manual intervention.
- Billing Model: In Apex, customers pay for the resources allocated by Salesforce, whereas Serverless follows a "pay-as-you-go" model where customers are only charged for the resources consumed during execution.
- Management of Infrastructure: With Apex, developers have limited control over the underlying infrastructure as it is managed by Salesforce, while Serverless allows developers to focus solely on writing code without the need to manage servers or infrastructure.
- Event-driven Architecture: Serverless functions are typically event-triggered, responding to specific events or requests, while Apex code in Salesforce is often executed in response to user interactions within the CRM system.
- Cold Start Times: In Serverless, there can be a delay in the cold start times when a function is invoked for the first time, compared to Apex where the execution time may be more predictable due to a dedicated environment.
In Summary, the key differences between Apex and Serverless lie in their execution environments, scalability, billing models, infrastructure management, event-driven architectures, and cold start times.
When adding a new feature to Checkly rearchitecting some older piece, I tend to pick Heroku for rolling it out. But not always, because sometimes I pick AWS Lambda . The short story:
- Developer Experience trumps everything.
- AWS Lambda is cheap. Up to a limit though. This impact not only your wallet.
- If you need geographic spread, AWS is lonely at the top.
Recently, I was doing a brainstorm at a startup here in Berlin on the future of their infrastructure. They were ready to move on from their initial, almost 100% Ec2 + Chef based setup. Everything was on the table. But we crossed out a lot quite quickly:
- Pure, uncut, self hosted Kubernetes — way too much complexity
- Managed Kubernetes in various flavors — still too much complexity
- Zeit — Maybe, but no Docker support
- Elastic Beanstalk — Maybe, bit old but does the job
- Heroku
- Lambda
It became clear a mix of PaaS and FaaS was the way to go. What a surprise! That is exactly what I use for Checkly! But when do you pick which model?
I chopped that question up into the following categories:
- Developer Experience / DX 🤓
- Ops Experience / OX 🐂 (?)
- Cost 💵
- Lock in 🔐
Read the full post linked below for all details
Pros of Apex
Pros of Serverless
- API integration14
- Supports cloud functions for Google, Azure, and IBM7
- Lower cost3
- Auto scale1
- Openwhisk1