Skip to content

Expose underlying infrastructures, runtime containers, Cpu performance and faults of serverless functions from AWS Lambda, GCP and Apache Openwhisk written in Python

License

Notifications You must be signed in to change notification settings

adhinneupane/aws-gcp-wsk-reverse-engineering

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

aws-logo google-platform-logo openwhisk-logo

Reverse Engineering of Serverless Functions

In your handler function:

from Inspector import *

def myFunction(request):
  
  # Initialize the Inspector and collect data.
  inspector = Inspector()
  inspector.inspectAll()

  # Add a "Hello World!" message.
  inspector.addAttribute("message", "Hello " + request['name'] + "!")

  # Return attributes collected.
  return inspector.finish()

Example Output JSON:

The attributes collected can be customized by changing which functions are called. For more detailed descriptions of each variable and the functions that collect them, please read the full documentation.

{
	"version": 0.2,
	"lang": "python",
	"cpuType": "Intel(R) Xeon(R) Processor @ 2.50GHz",
	"cpuModel": 63,
	"vmuptime": 1551727835,
	"uuid": "d241c618-78d8-48e2-9736-997dc1a931d4",
	"vmID": "tiUCnA",
	"platform": "AWS Lambda",
	"newcontainer": 1,
	"cpuUsrDelta": "904",
	"cpuNiceDelta": "0",
	"cpuKrnDelta": "585",
	"cpuIdleDelta": "82428",
	"cpuIowaitDelta": "226",
	"cpuIrqDelta": "0",
	"cpuSoftIrqDelta": "7",
	"vmcpustealDelta": "1594",
	"frameworkRuntime": 35.72,
	"message": "Hello John Doe!",
	"runtime": 38.94
}

Metrics Collected

uuid:            A unique identifier assigned to a container if one does not already exist.
newcontainer:    Whether a container is new (no assigned uuid) or if it has been used before.
vmuptime:        The time when the system started in Unix time.
cpuUsrDelta:      Time spent normally executing in user mode.
cpuNiceDelta:     Time spent executing niced processes in user mode.
cpuKrnDelta:      Time spent executing processes in kernel mode.
cpuIdleDelta:     Time spent idle.
cpuIowaitDelta:   Time spent waiting for I/O to complete.
cpuIrqDelta:      Time spent servicing interrupts.
cpuSoftIrqDelta:  Time spent servicing software interrupts.
vmcpustealDelta:  Time spent waiting for real CPU while hypervisor is using another virtual CPU.
contextSwitchesDelta: Number of context switches.

Sample Architecture and Results: [AWS]

image

Sample Results

image

Author

Ashutosh Neupane
adhinneupane2020@gmail.com

About

Expose underlying infrastructures, runtime containers, Cpu performance and faults of serverless functions from AWS Lambda, GCP and Apache Openwhisk written in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages