1、silvexis1Erik PetersonErik Peterson FOUNDER&CTOBeyond Million Dollar Lines of CodePractical Strategies for Engineering Cost-Effective Cloud Systemssilvexis2Im Erik,Im the CTO and Founder of CloudZero.Ive been building in the Cloud since 2006.Im a Serverless believer,startup addict and I founded Clou
2、dZero in 2016 to empower engineers to build profitable cloud silvexis3EVERY ENGINEERINGDECISION IS A BUYING DECISIONsilvexisThe move to cloud will not happen in our lifetime unless it makes strong economic sense.silvexis5FINANCES PROBLEM NOWFINANCES PROBLEM NOWWORKED FINE FOR DEVWORKED FINE FOR DEVs
3、ilvexissilvexis6ITS GONNA COST YOU A LOTsilvexissilvexisWhat is a Million Dollar Line of Code?silvexis8def write_data_to_dynamodb(k_data:dict):#write 1000 byte record to DynamoDB and add a timestamp k_datatimestamp=datetime.now().astimezone(tz=timezone.utc).isoformat()dynamodb=boto3.resource(dynamod
4、b)table=dynamodb.Table(my-table)table.put_item(Item=data:k_data)silvexis9def write_data_to_dynamodb(k_data:dict):#write 1000 byte record to DynamoDB and add a timestamp k_datatimestamp=datetime.now().astimezone(tz=timezone.utc).isoformat()dynamodb=boto3.resource(dynamodb)table=dynamodb.Table(my-tabl
5、e)table.put_item(Item=data:k_data)1000+32+9=1041 BytesOver the 1024 limit per WCU by 17 bytesWrite costs are now 2xsilvexis10def write_data_to_dynamodb(k_data:dict):#write 1000 byte record to DynamoDB and add a timestamp k_datats=datetime.utcnow().isoformat(timespec=seconds)+Z dynamodb=boto3.resourc
6、e(dynamodb)table=dynamodb.Table(my-table)table.put_item(Item=data:k_data)THE FIX1000+20+2=1022 BytesUnder the 1024 limit per WCUsilvexisBut how do I find these lines of code?silvexisAxiom 1:Only observed costs are accuratesilvexisSource:Structured Programming with goto Statements,Kunth,1974 First,A