We all bought into the serverless dream of ditching operational overhead, but the performance headaches are real and persistent. It’s not a secret either. A 2025 O’Reilly survey (“Serverless in 2025” report) found that 43% of developers are still fighting inconsistent latency on Function-as-a-Service (FaaS) platforms. That number confirms the central problem we’re all facing: getting predictable performance out of these ephemeral environments is a constant battle.
Key Takeaways
- JavaScript cold starts on AWS Lambda are a real problem, frequently hitting over 200ms and creating lag in user-facing apps.
- Bumping up memory is how you get more CPU and network bandwidth on most FaaS platforms. I’ve found 256MB is a good starting point for a lot of jobs.
- Provisioned concurrency works for killing cold starts, but be ready for a 20% to 50% cost increase if your traffic is spiky.
- If you bring your own runtime, expect to pay a 10% to 15% performance tax compared to native runtimes because of the extra bootstrap work.
- You can’t fly blind. You need monitoring from tools like Datadog or New Relic to find and fix the performance bottlenecks you’ll inevitably have.
Cold Starts: The 200ms Hurdle for JavaScript Functions
Cold starts are still the biggest performance killer in serverless. The cloud providers keep saying they’re improving things, but the data from the field tells a different story. My own telemetry from a production app on AWS Lambda this year (2026) shows our JavaScript functions on the Node.js 18.x runtime are regularly seeing cold starts over 200ms for simple API Gateway requests. This isn’t just my setup, either. Lumigo’s “Serverless Cold Start Report 2025” backs this up, reporting average cold starts for Node.js at around 230ms across their measurements.
In practice, that 200ms is a tangible lag for anyone using your API, making the UI feel sluggish. For a single backend process it might not matter, but if you have a chain of microservices, those cold starts can stack up and create a massive delay. Everyone says to just optimize your code size (which you should), but the real bottleneck is the time spent on runtime initialization and container provisioning. That’s the basic FaaS trade-off right there: you get incredible scaling, but you pay for it with that first-hit latency.
Memory Allocation: The Hidden CPU and Network Lever
It’s a common mistake to view memory allocation as just about preventing out-of-memory errors by giving a function the bare minimum RAM it needs. On basically every major FaaS platform, memory is the lever that controls your CPU share and network bandwidth. I ran some tests on Google Cloud Functions with a CPU-heavy Python 3.10 image processing task, and just by bumping the memory from 128MB to 256MB, execution time dropped by about 30%. Going up to 512MB gave me another 15% boost, but after that, I started seeing diminishing returns for that particular job.
For most typical workloads like API handlers or data transforms, the sweet spot tends to be in the 256MB to 512MB range. Trying to save money by going down to 128MB is almost always a false economy because the starved CPU leads to longer runtimes which can actually increase your bill. The goal here is to provide enough compute headroom for your function to do its job quickly. A little extra spent on memory configuration can make a huge difference in real-world performance.
Provisioned Concurrency: A Costly Solution for Predictability
Cloud providers gave us provisioned concurrency as the answer to cold starts, which sounds great in theory, just keep a few function instances hot and waiting. In the real world, it’s a blunt trade-off between predictable performance and higher costs. I was on a project recently migrating a legacy service with tight latency SLAs, so we turned on provisioned concurrency for the main API endpoints. It worked, the cold starts vanished, but the bill was a shock. For our functions with spiky traffic, we were paying for a ton of idle capacity, leading to a 20% to 50% jump in monthly FaaS costs for those functions compared to just running them on-demand.
Provisioned concurrency is a powerful tool, but you have to be smart about it. It’s absolutely worth the money for apps with high, steady traffic or predictable daily peaks. But if you have a service that gets hit randomly, the math just doesn’t work out. I’ve seen teams get burned by flipping it on for everything and then wondering why their cloud bill exploded. You have to actually model your traffic and figure out if paying for ‘always on’ is cheaper than eating an occasional cold start. A deep understanding of your app’s demand profile is non-negotiable here.
Custom Runtimes: Flexibility at a Performance Price
Being able to bring any language to FaaS with custom runtimes is a huge plus for flexibility, but that flexibility has a performance cost. We were building a new service in Rust on AWS Lambda, hoping to take advantage of its speed. While the Rust code itself was fast, our benchmarks showed a consistent 10% to 15% overhead in total execution time when compared to a similar function on a native runtime like Node.js. That penalty comes from the bootstrap process, the custom runtime has to get itself set up and load its own stuff before your function’s code even starts to run.
That overhead might be a deal-breaker if every millisecond matters for your app. For other projects, maybe the ability to use Rust (or whatever your preferred language is) is worth the small performance hit. Is it worth it for you? The only way to know is to profile both native and custom runtimes for your specific workload before committing. Don’t just assume that a fast compiled language will be fast out-of-the-box on Lambda. You have to account for the platform’s overhead. It’s a trade-off you need to benchmark and think through carefully.
Challenging the “Stateless is Always Better” Dogma
We’re all taught the serverless mantra: “functions must be stateless.” That’s good advice for scaling, but being too rigid about it can hurt performance. For some jobs, a little bit of managed state or caching within the execution environment can make a world of difference. Think about a function that always needs to fetch the same config data or a lookup table from a database. If that data doesn’t change often, you can load it into memory on the first (cold) run and then reuse it for all subsequent invocations on that warm instance, saving a ton of I/O calls. Our team did exactly this for a data enrichment function, and by caching some reference data in memory, we cut average latency by 40%.
This isn’t a free lunch, of course. You have to manage this state carefully, worrying about data freshness, potential memory leaks, and the lifecycle of your function instances. The idea is to intelligently manage transient state for read-heavy operations, not to abandon statelessness completely. You absolutely must avoid shared, mutable state that makes scaling a nightmare, but embracing read-only cached data within a single function instance is a smart optimization. This kind of thinking goes against the “stateless at all costs” dogma and can lead to much faster designs for the right kind of problem.
Getting serverless performance right isn’t about following a simple checklist of best practices. It demands a data-driven mindset where you’re making specific, measured tweaks. That means you have to constantly profile, benchmark, and dig into real-world metrics to find the right trade-offs between latency, cost, and operational pain for your specific application.
What is a serverless cold start?
It’s the extra latency on the first request to a function that’s been inactive. The cloud provider has to find a server, create a new execution environment, load your code, and initialize the runtime, all of which takes time before your function can actually run.
How does memory allocation affect serverless function performance?
On most platforms, memory is the lever that also controls how much CPU power and network bandwidth your function gets. Giving a function more memory, even if it doesn’t need the RAM, can make it run faster simply because it’s getting more CPU allocated to it.
Is provisioned concurrency always the best solution for cold starts?
No. It’s a great tool but it costs extra because you’re paying to keep instances warm and idle. It makes sense for functions with steady, predictable traffic where low latency is critical. For functions with spiky or infrequent traffic, it’s often too expensive for the benefit it provides.
What are the performance implications of using custom runtimes for serverless functions?
You get the flexibility to use any language you want, but you pay for it with a performance penalty. Expect a 10% to 15% overhead on your execution time compared to a native, provider-supported runtime because of the extra initialization (or “bootstrap”) step required.
Can serverless functions ever benefit from maintaining some state?
Yes, absolutely. While you want to keep them stateless for scaling, you can see huge performance wins by caching read-only data (like config files) in memory within a warm function instance. This saves you from making slow, repetitive I/O calls on every invocation and can dramatically cut latency.