为何免费版AWS Lambda并发实例仅100而非标称的1000?
Lambda免费计划实例数未达预期问题
- 相关图表
- 相关调用记录
亚马逊官方说明免费计划默认支持1000个Lambda实例,但我在高负载压测、同时发送多请求时,仅分配了100个实例,原本预期能分配全部1000个实例,请问这是什么原因?
SAM配置模板
AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Globals: Function: Timeout: 50 MemorySize: 3000 Tracing: Active Api: TracingEnabled: true Resources: InferenceFunction: Type: AWS::Serverless::Function Properties: PackageType: Image Architectures: - x86_64 Events: Inference: Type: Api Properties: Path: /predict Method: post Metadata: Dockerfile: Dockerfile DockerContext: ./app DockerTag: python3.9-v1 ApplicationResourceGroup: Type: AWS::ResourceGroups::Group Properties: Name: Fn::Join: - '' - - ApplicationInsights-SAM- - Ref: AWS::StackName ResourceQuery: Type: CLOUDFORMATION_STACK_1_0 ApplicationInsightsMonitoring: Type: AWS::ApplicationInsights::Application Properties: ResourceGroupName: Fn::Join: - '' - - ApplicationInsights-SAM- - Ref: AWS::StackName AutoConfigurationEnabled: 'true' DependsOn: ApplicationResourceGroup Outputs: InferenceApi: Description: API Gateway endpoint URL for Prod stage for Inference function Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/predict/" InferenceFunction: Description: Inference Lambda Function ARN Value: !GetAtt InferenceFunction.Arn InferenceFunctionIamRole: Description: Implicit IAM Role created for Inference function Value: !GetAtt InferenceFunctionRole.Arn
Lambda处理器Python代码
import json from analyzer.model import Model model_file = '/opt/ml/model' model = Model(model_file, device="cpu") def lambda_handler(event, context): sample = event['body'] result = model(sample) return { 'statusCode': 200, 'body': json.dumps( { "predicted_label": result.value } ) }
Dockerfile内容
FROM public.ecr.aws/lambda/python:3.9 COPY . . RUN python3.9 -m pip install -r requirements.txt -t . CMD ["app.lambda_handler"]
内容的提问来源于stack exchange,提问作者Danielto1404
相关产品推荐
相关产品推荐

