Serverless for Monitoring
how to debug on serverless ?
how’s the security for using serverless ?
hoe’s the latency ?
how’s the cost ?
“Less is More”
we have to focus on other things not just only code when using serverless
Structure is Changing
During the application structure is changing to CaaS, we have to reduce the instances which are not for application layer as possible as we can, to avoid launching more and more instances which unnecessary to save cost.
“Switching those instances to serverless is a good solution”
What is Serverless
- Event driven
- No needs to hosting infrasturature by ourself
- High Reliable (hosting by third party)
- Launch by crontab not always online
- But not all of services suit serverless
What is the benefit for using Serverless
- Enchance effectivence
- No needs to manage instances including scaling
- Cost down (if you use it on correct way)
- Micro services
What is the shortcomings for using Serverless
- Lang (Node.js/Python/Go/C#….. but no Ruby!!)
- How to test, debug and collect log ?
- How to monitor your Lambda monitoring functions ?
- How to CI/CD and version control ?
- Should not launch for long time
- Depends on third party services (e.g. It’s too difficult from using AWS Lambda to Azure Functions)
- Performance (high cold start time)
“You buy a car just like using EC2, rent a car just like using Lambda”
When should we using Serverless
- lower requests count
- high networking traffic but in very short time (In EC2 case, we need to scale out first or auto scaling, but auto scaling is not fast at all to againest short time traffic)
-> Push notification to user
-> IoT
-> Data Analyze
-> Chatbot
-> Monitoring
Monitoring by Serverless
- Latency (Domain name lookup / TCP TLS handshake)
- cURL is a excellent tool
Common use case
What can we do or improve something ?
- Nginx access log & Application production log -> EFK
- Nginx error log (log level: warn) -> cloudwatch -> Lambda -> Slack
- Don’t Stream Access logs and others which Lambda doesn’t need to save money
- Build Slack slash command for request count/latency/4xx error…etc count
- Slack App for alert massive error log
- Slack App for check merchant’s shops SSL expiration day
- Version control Lambda function for AB testing
Reference
https://day.ithome.com.tw/serverless/
Cliff
https://github.com/clifflu?tab=repositories
Poga - Built his own serverless called Spacer
https://github.com/poga/spacer
Rick Huang - 91APP tech manager
https://rickhw.github.io/