Commit b34248d1 authored by Andreas Muttscheller's avatar Andreas Muttscheller

Initial commit

parents
.serverless/
node_modules
.idea
*.class
*.log
# sbt specific
.cache/
.history/
.lib/
dist/*
target/
lib_managed/
src_managed/
project/boot/
project/plugins/project/
# Scala-IDE specific
.scala_dependencies
.worksheet
.idea
enablePlugins(GatlingPlugin)
name := "aws_lambda_bench"
organization := "de.codecentric.amuttsch"
description := "Benchmark for AWS Lambda "
licenses += "Apache License, Version 2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0")
version := "0.1"
scalaVersion := "2.12.8"
scalacOptions := Seq(
"-encoding", "UTF-8", "-target:jvm-1.8", "-deprecation",
"-feature", "-unchecked", "-language:implicitConversions", "-language:postfixOps")
libraryDependencies += "io.gatling.highcharts" % "gatling-charts-highcharts" % "3.0.3" % "test"
libraryDependencies += "io.gatling" % "gatling-test-framework" % "3.0.3" % "test"
addSbtPlugin("io.gatling" % "gatling-sbt" % "3.0.0")
package de.codecentric.amuttsch.awsbench
import ch.qos.logback.classic.{Level, LoggerContext}
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import org.slf4j.LoggerFactory
import scala.concurrent.duration._
class LambdaBench extends Simulation {
val context: LoggerContext = LoggerFactory.getILoggerFactory.asInstanceOf[LoggerContext]
// Suppress logging
context.getLogger("io.gatling").setLevel(Level.valueOf("WARN"))
context.getLogger("io.netty").setLevel(Level.valueOf("WARN"))
val baseFunctionUrl: String = sys.env("AWS_BENCH_BASE_URL")
val httpProtocol = http
.baseUrl(baseFunctionUrl)
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.acceptLanguageHeader("en-US,en;q=0.5")
.acceptEncodingHeader("gzip, deflate")
.userAgentHeader("Mozilla/5.0 (X11; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0")
val scalaScenario = scenario("ScalaScenario")
.exec(http("Scala")
.get("/scala"))
val javaScenario = scenario("JavaScenario")
.exec(http("Java")
.get("/java"))
setUp(
scalaScenario.inject(constantConcurrentUsers(1) during(120 seconds)),
javaScenario.inject(constantConcurrentUsers(1) during(120 seconds))
).protocols(httpProtocol)
}
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.idea/
target/
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.codecentric.amuttsch</groupId>
<artifactId>aws_lambda_bench_java</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-core</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-events</artifactId>
<version>2.2.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package de.codecentric.amuttsch.awsbench.java;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
public class JavaLambda {
public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent event, Context context) {
return new APIGatewayProxyResponseEvent()
.withStatusCode(200);
}
}
*.class
*.log
# sbt specific
.cache/
.history/
.lib/
dist/*
target/
lib_managed/
src_managed/
project/boot/
project/plugins/project/
# Scala-IDE specific
.scala_dependencies
.worksheet
.idea
name := "aws_lambda_bench_scala"
organization := "de.codecentric.amuttsch"
description := "Benchmark Service for AWS Lambda written in Scala"
licenses += "Apache License, Version 2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0")
version := "0.1"
scalaVersion := "2.12.8"
assemblyJarName in assembly := "aws_lambda_bench_scala.jar"
libraryDependencies ++= Seq(
// AWS
"com.amazonaws" % "aws-lambda-java-core" % "1.2.0",
"com.amazonaws" % "aws-lambda-java-events" % "2.2.5",
)
resolvers += Resolver.sonatypeRepo("public")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")
\ No newline at end of file
package de.codecentric.amuttsch.awsbench.scala
import com.amazonaws.services.lambda.runtime.Context
import com.amazonaws.services.lambda.runtime.events.{APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent}
class ScalaLambda {
def handleRequest(event: APIGatewayProxyRequestEvent, context: Context): APIGatewayProxyResponseEvent = {
new APIGatewayProxyResponseEvent()
.withStatusCode(200)
}
}
\ No newline at end of file
service: lambda-java-scala-bench
provider:
name: aws
runtime: java8
region: eu-central-1
logRetentionInDays: 1
package:
individually: true
functions:
ScalaLambda:
handler: de.codecentric.amuttsch.awsbench.scala.ScalaLambda::handleRequest
reservedConcurrency: 1
package:
artifact: scala/target/scala-2.12/aws_lambda_bench_scala.jar
events:
- http:
path: scala
method: get
JavaLambda:
handler: de.codecentric.amuttsch.awsbench.java.JavaLambda::handleRequest
reservedConcurrency: 1
package:
artifact: java/target/aws_lambda_bench_java-0.1.jar
events:
- http:
path: java
method: get
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment