mirror of
https://github.com/floci-io/floci.git
synced 2026-11-26 23:29:28 -05:00
fix(lambda): limit a function container's memory and swap together to its MemorySize (#7704)
This commit is contained in:
1 parent
8b81638490
commit
8bc134cc84
2 files changed
+38
-1
No files matched your search
@@ -292,10 +292,14 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
|
||||
env.add("AWS_LAMBDA_INITIALIZATION_TYPE=provisioned-concurrency");
|
||||
}
|
||||
|
||||
// Memory and swap together at the function's MemorySize, so the container cannot swap
|
||||
// and has what Lambda gives the function, whatever swap the host has.
|
||||
long memoryBytes = (long) fn.getMemorySize() * 1024 * 1024;
|
||||
ContainerBuilder.Builder specBuilder = containerBuilder.newContainer(image)
|
||||
.withName(containerName)
|
||||
.withEnv(env)
|
||||
.withMemoryMb(fn.getMemorySize())
|
||||
.withMemoryBytes(memoryBytes)
|
||||
.withMemorySwapBytes(memoryBytes)
|
||||
.withDockerNetwork(config.services().lambda().dockerNetwork())
|
||||
.withLogRotation()
|
||||
.withLabels(ContainerStorageHelper.resourceIdentityLabels(
|
||||
|
||||
Reference in new issue
Block a user