This repository has been archived by the owner on Sep 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Project Upgrade/Simplification (#12)
* Upgrade project * Uses the auto-generated client instead of a custom one * Moves PersonServiceHandler moved to server implicits * Updates README to 20 iter and w-iter instead of 10 * Brings the new benchmark results based on 20 iterations * Upgrades radar chart * Removes Thread.sleep. It also: * Provides a new bar chart diagram. * Update all the benchmark results
- Loading branch information
1 parent
fdc3d8e
commit 92a6069
Showing
18 changed files
with
1,200 additions
and
912 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,7 @@ project/plugins/project/ | |
/out/ | ||
.idea_modules/ | ||
|
||
# Benchmark results | ||
bench/*.txt | ||
|
||
.DS_Store |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
package metrifier | ||
package benchmark | ||
|
||
import freestyle._ | ||
import freestyle.implicits._ | ||
import org.openjdk.jmh.annotations._ | ||
import metrifier.rpc.client.RPCClient | ||
import metrifier.shared.model._ | ||
import metrifier.benchmark.rpc.implicits._ | ||
import java.util.concurrent.TimeUnit | ||
|
||
import metrifier.rpc.protocols.PersonService | ||
import monix.eval.Task | ||
|
||
import scala.concurrent.duration.Duration | ||
|
@@ -19,84 +17,56 @@ import scala.concurrent.Await | |
@OutputTimeUnit(TimeUnit.SECONDS) | ||
class RPCBenchmark { | ||
|
||
@Benchmark | ||
def listPersons: PersonList = { | ||
|
||
def program[M[_]](implicit APP: RPCClient[M]): FreeS[M, PersonList] = APP.listPersons | ||
|
||
Await.result(program[RPCClient.Op].interpret[Task].runAsync, Duration.Inf) | ||
} | ||
val client: PersonService.Client[Task] = implicitly[PersonService.Client[Task]] | ||
val p5: Person = Person( | ||
id = "5", | ||
name = PersonName(title = "ms", first = "valentine", last = "lacroix"), | ||
gender = "female", | ||
location = Location( | ||
street = "1494 avenue du fort-caire", | ||
city = "orléans", | ||
state = "aveyron", | ||
postCode = 91831), | ||
email = "[email protected]", | ||
picture = None | ||
) | ||
|
||
@Benchmark | ||
def getPerson: Person = { | ||
|
||
def program[M[_]](implicit APP: RPCClient[M]): FreeS[M, Person] = APP.getPerson("1") | ||
|
||
Await.result(program[RPCClient.Op].interpret[Task].runAsync, Duration.Inf) | ||
} | ||
def listPersons: PersonList = Await.result(client.listPersons("foo").runAsync, Duration.Inf) | ||
|
||
@Benchmark | ||
def getPersonLinks: PersonLinkList = { | ||
|
||
def program[M[_]](implicit APP: RPCClient[M]): FreeS[M, PersonLinkList] = APP.getPersonLinks("1") | ||
|
||
Await.result(program[RPCClient.Op].interpret[Task].runAsync, Duration.Inf) | ||
} | ||
def getPerson: Person = Await.result(client.getPerson("1").runAsync, Duration.Inf) | ||
|
||
@Benchmark | ||
def createPerson: Person = { | ||
def getPersonLinks: PersonLinkList = | ||
Await.result(client.getPersonLinks("1").runAsync, Duration.Inf) | ||
|
||
def program[M[_]](implicit APP: RPCClient[M]): FreeS[M, Person] = | ||
APP.createPerson( | ||
id = "5", | ||
nameTitle = "ms", | ||
nameFirst = "valentine", | ||
nameLast = "lacroix", | ||
gender = "female", | ||
locationStreet = "1494 avenue du fort-caire", | ||
locationCity = "orléans", | ||
locationState = "aveyron", | ||
locationPostCode = 91831, | ||
email = "[email protected]", | ||
pictureLarge = None, | ||
pictureMedium = None, | ||
pictureThumbnail = None | ||
) | ||
|
||
Await.result(program[RPCClient.Op].interpret[Task].runAsync, Duration.Inf) | ||
} | ||
@Benchmark | ||
def createPerson: Person = | ||
Await.result( | ||
client | ||
.createPerson(p5) | ||
.runAsync, | ||
Duration.Inf | ||
) | ||
|
||
@Benchmark | ||
def programComposition: PersonAggregation = { | ||
|
||
def program[M[_]](implicit APP: RPCClient[M]): FreeS[M, PersonAggregation] = { | ||
def clientProgram: Task[PersonAggregation] = { | ||
for { | ||
personList <- APP.listPersons | ||
p1 <- APP.getPerson("1") | ||
p2 <- APP.getPerson("2") | ||
p3 <- APP.getPerson("3") | ||
p4 <- APP.getPerson("4") | ||
p1Links <- APP.getPersonLinks(p1.id) | ||
p3Links <- APP.getPersonLinks(p3.id) | ||
pNew <- APP.createPerson( | ||
id = "5", | ||
nameTitle = "ms", | ||
nameFirst = "valentine", | ||
nameLast = "lacroix", | ||
gender = "female", | ||
locationStreet = "1494 avenue du fort-caire", | ||
locationCity = "orléans", | ||
locationState = "aveyron", | ||
locationPostCode = 91831, | ||
email = "[email protected]", | ||
pictureLarge = None, | ||
pictureMedium = None, | ||
pictureThumbnail = None | ||
) | ||
personList <- client.listPersons("foo") | ||
p1 <- client.getPerson("1") | ||
p2 <- client.getPerson("2") | ||
p3 <- client.getPerson("3") | ||
p4 <- client.getPerson("4") | ||
p1Links <- client.getPersonLinks(p1.id) | ||
p3Links <- client.getPersonLinks(p3.id) | ||
pNew <- client.createPerson(p5) | ||
} yield (p1, p2, p3, p4, p1Links, p3Links, personList.add(pNew)) | ||
} | ||
|
||
Await.result(program[RPCClient.Op].interpret[Task].runAsync, Duration.Inf) | ||
Await.result(clientProgram.runAsync, Duration.Inf) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,48 +2,44 @@ package metrifier | |
package demo | ||
package rpc | ||
|
||
import freestyle._ | ||
import metrifier.shared.model._ | ||
import metrifier.rpc.client.RPCClient | ||
import metrifier.demo.rpc.implicits._ | ||
import metrifier.rpc.protocols.PersonService | ||
import monix.eval.Task | ||
|
||
import scala.concurrent.Await | ||
import scala.concurrent.duration._ | ||
|
||
object RPCDemoApp { | ||
|
||
def clientProgram[M[_]](implicit APP: RPCClient[M]): FreeS[M, PersonAggregation] = { | ||
def clientProgram(implicit client: PersonService.Client[Task]): Task[PersonAggregation] = { | ||
for { | ||
personList <- APP.listPersons | ||
p1 <- APP.getPerson("1") | ||
p2 <- APP.getPerson("2") | ||
p3 <- APP.getPerson("3") | ||
p4 <- APP.getPerson("4") | ||
p1Links <- APP.getPersonLinks(p1.id) | ||
p3Links <- APP.getPersonLinks(p3.id) | ||
pNew <- APP.createPerson( | ||
id = "5", | ||
nameTitle = "ms", | ||
nameFirst = "valentine", | ||
nameLast = "lacroix", | ||
gender = "female", | ||
locationStreet = "1494 avenue du fort-caire", | ||
locationCity = "orléans", | ||
locationState = "aveyron", | ||
locationPostCode = 91831, | ||
email = "[email protected]", | ||
pictureLarge = None, | ||
pictureMedium = None, | ||
pictureThumbnail = None | ||
) | ||
personList <- client.listPersons("foo") | ||
p1 <- client.getPerson("1") | ||
p2 <- client.getPerson("2") | ||
p3 <- client.getPerson("3") | ||
p4 <- client.getPerson("4") | ||
p1Links <- client.getPersonLinks(p1.id) | ||
p3Links <- client.getPersonLinks(p3.id) | ||
pNew <- client.createPerson(Person( | ||
id = "5", | ||
name = PersonName(title = "ms", first = "valentine", last = "lacroix"), | ||
gender = "female", | ||
location = Location( | ||
street = "1494 avenue du fort-caire", | ||
city = "orléans", | ||
state = "aveyron", | ||
postCode = 91831), | ||
email = "[email protected]", | ||
picture = None | ||
)) | ||
} yield (p1, p2, p3, p4, p1Links, p3Links, personList.add(pNew)) | ||
} | ||
|
||
def main(args: Array[String]): Unit = { | ||
|
||
val result: PersonAggregation = | ||
Await.result(clientProgram[RPCClient.Op].interpret[Task].runAsync, Duration.Inf) | ||
Await.result(clientProgram.runAsync, Duration.Inf) | ||
|
||
println(s"Result = $result") | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.