Commit ae40d5b9 authored by Andreas Muttscheller's avatar Andreas Muttscheller

Minor refactor

parent 9107478a
package de.codecentric.amuttsch.bahndelayinfo.aws.lambda
import java.util.concurrent.atomic.AtomicInteger
import com.amazonaws.services.dynamodbv2.document.{DynamoDB, Item, Table}
import com.amazonaws.services.dynamodbv2.{AmazonDynamoDB, AmazonDynamoDBClientBuilder}
import com.amazonaws.services.lambda.runtime.Context
......@@ -15,9 +13,7 @@ import org.json4s._
import org.json4s.native.JsonMethods._
import org.json4s.native.Serialization.write
import scala.collection.JavaConverters._
import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
class APIStationQuery {
implicit val logger: Logger = Logger(classOf[APISlackBotEventHandlerWorker])
......@@ -92,32 +88,3 @@ class APIStationQuery {
}
}
}
object TestDynamoDbTiming extends App {
import scala.concurrent.ExecutionContext.Implicits.global
val ddbClient: AmazonDynamoDB = AmazonDynamoDBClientBuilder.standard.build
val ddb: DynamoDB = new DynamoDB(ddbClient)
val tableStations: Table = ddb.getTable("Stations")
val asq = new APIStationQuery()
val request = new APIGatewayProxyRequestEvent()
.withQueryStringParameters(Map("eva" -> "8000105").asJava)
val i = new AtomicInteger(0)
val startTime = System.currentTimeMillis()
(0 to 100).map { _ =>
Future {
(0 to 10).foreach { _ =>
asq.handleRequest(request, null)
i.incrementAndGet()
}
}
}.map(f => Await.ready(f, Duration.Inf))
val endTime = System.currentTimeMillis()
println(s"Time for ${i.get} getItems = ${endTime-startTime} ms")
asq.esClient.close()
}
\ No newline at end of file
package de.codecentric.amuttsch.bahndelayinfo.aws.lambda.bench
package de.codecentric.amuttsch.bahndelayinfo.aws.lambda.gatling
import ch.qos.logback.classic.{Level, LoggerContext}
import com.typesafe.config.{Config, ConfigFactory}
......
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