Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tinfoilman's avatar

Vapor memory allocation affects speed, oops

This isn't a question, but a heads up that I didn't know about. About a week ago I tried changing the memory of my production app from 1024 to 128MB. My thinking was that Telescope was telling me I was rarely using more than 4MB of memory to serve a request, so why the heck do I need 1024MB in Lambda?

The last few days I was catching on to the fact that my site seemed to be slower. At first I thought maybe it was me adding more crap in the code, and then I thought maybe AWS was having a bad few days LOL. But that didn't make sense. My page requests were taking over a second sometimes. A huge difference in speed when browsing.

So tonight I did some Googling to see if it's possible to increase CPU on Lambda, and what what do you know, hidden away in the docs it said that CPU and other resources are scaled proportionally with the memory! Well that sucks, but I can see how it sort of makes sense. So I put my memory back up to 1024MB and pages are loading 2-5x faster now, yay! Wish I knew this earlier. In fact, since you're charged by 100ms increments, it's not much more expensive to go with the higher memory with less compute time.

0 likes
0 replies

Please or to participate in this conversation.