Slide 1

Slide 1 text

PLAY FRAMEWORK V SPRING WEB MVC Eko Kurniawan Khannedy Blibli.com

Slide 2

Slide 2 text

Play Framework • Play Framework 2.5.3 • Scala 2.11.8 • Akka 2.4.4

Slide 3

Slide 3 text

Spring Web MVC • Spring Boot • Spring Web MVC • Java 8 • Apache Tomcat • Thymeleaf

Slide 4

Slide 4 text

BENCHMARK SCENARIO Play Framework vs Spring Web MVC

Slide 5

Slide 5 text

Benchmark Scenario • Hello $name • Hello $name as JSON • Hello $name as HTML • 2 Seconds Blocking Process • Atomic Increment • Big JSON • Call Services Asynchronously

Slide 6

Slide 6 text

Hello $name • Client will send request GET with parameter name • Server will response as TEXT with response Hello $name • Request will send using JMeter with 500 thread with 1.000 request per thread, total 500.000 request.

Slide 7

Slide 7 text

Hello $name HTML • Client will request to server with query parameter name • Server will send response as HTML to client with message Hello $name • Request will send using JMeter with 500 thread with 1000 request per thread, total 500.000 request.

Slide 8

Slide 8 text

Hello $name JSON • Client will request to server with query parameter name • Server will send response as JSON to client with message Hello $name • Request will send using JMeter with 500 thread with 1000 request per thread, total 500.000 request.

Slide 9

Slide 9 text

2 Seconds Blocking Process • Client will send request to serve with parameter $name • Server will block the process 2 seconds, and after 2 seconds, server will response to client with TEXT body Hello $name • Request will send using JMeter with 500 thread with 10 request per thread, total 5.000 request.

Slide 10

Slide 10 text

Atomic Increment • Client will send request to server • Server will increment atomic variable and return the new increment value to client • Request will send using JMeter with 500 thread with 1000 request per thread, total 500.000 request.

Slide 11

Slide 11 text

Big JSON • Client will send request to server • Server will generate big JSON array (more than 100 record json object) • Request will send using JMeter with 500 thread with 1000 request per thread, total 500.000 request.

Slide 12

Slide 12 text

Call Service Asynchronously • Client will send request to server • Server will call 3 services asynchronously with every service block for 1 seconds, after get all data from 3 services, the result will be send to client • Request will send using JMeter with 500 thread with 200 request per thread, total 100.000 request.

Slide 13

Slide 13 text

BENCHMARK RESULT Play Framework vs Spring Web MVC

Slide 14

Slide 14 text

HELLO $NAME Play Framework vs Spring Web MVC

Slide 15

Slide 15 text

Spring Web MVC

Slide 16

Slide 16 text

Play Framework

Slide 17

Slide 17 text

Spring Web MVC

Slide 18

Slide 18 text

Play Framework

Slide 19

Slide 19 text

Benchmark Result 500000 Request Play Framework 33.2 Spring Web MVC 68 0 10 20 30 40 50 60 70 80 Seconds Time Required to Complete 500000 Request Play Framework 15054 Spring Web MVC 7353 0 2000 4000 6000 8000 10000 12000 14000 16000 Request per Second Request per Second

Slide 20

Slide 20 text

HELLO $NAME HTML Play Framework vs Spring Web MVC

Slide 21

Slide 21 text

Spring Web MVC

Slide 22

Slide 22 text

Play Framework

Slide 23

Slide 23 text

Spring Web MVC

Slide 24

Slide 24 text

Play Framework

Slide 25

Slide 25 text

Benchmark Result 500000 Request Play Framework 30 Spring Web MVC 72 0 10 20 30 40 50 60 70 80 Seconds Time Required to Complete 500000 Request Play Framework 16431 Spring Web MVC 6990 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 Request per Second Request per Second

Slide 26

Slide 26 text

HELLO $NAME JSON Play Framework vs Spring Web MVC

Slide 27

Slide 27 text

Spring Web MVC

Slide 28

Slide 28 text

Play Framework

Slide 29

Slide 29 text

Spring Web MVC

Slide 30

Slide 30 text

Play Framework

Slide 31

Slide 31 text

Benchmark Result 500000 Request Play Framework 32 Spring Web MVC 87 0 10 20 30 40 50 60 70 80 90 100 Seconds Time Required to Complete 500000 Request Play Framework 15400 Spring Web MVC 5757 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 Request per Second Request per Second

Slide 32

Slide 32 text

2 SECONDS BLOCKING Play Framework vs Spring Web MVC

Slide 33

Slide 33 text

Spring Web MVC

Slide 34

Slide 34 text

Play Framework

Slide 35

Slide 35 text

Spring Web MVC

Slide 36

Slide 36 text

Play Framework

Slide 37

Slide 37 text

Benchmark Result 5000 Request Play Framework 21 Spring Web MVC 51 0 10 20 30 40 50 60 Seconds Time Required to Complete 5000 Request Play Framework 234 Spring Web MVC 98 0 50 100 150 200 250 Request per Second Request per Second

Slide 38

Slide 38 text

ATOMIC INCREMENT Play Framework vs Spring Web MVC

Slide 39

Slide 39 text

Spring Web MVC

Slide 40

Slide 40 text

Play Framework

Slide 41

Slide 41 text

Spring Web MVC

Slide 42

Slide 42 text

Play Framework

Slide 43

Slide 43 text

Benchmark Result 500000 Request Play Framework 27.4 Spring Web MVC 110 0 20 40 60 80 100 120 Seconds Time Required to Complete 500000 Request Play Framework 18268 Spring Web MVC 4541 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 Request per Second Request per Second

Slide 44

Slide 44 text

BIG JSON Play Framework vs Spring Web MVC

Slide 45

Slide 45 text

Spring Web MVC

Slide 46

Slide 46 text

Play Framework

Slide 47

Slide 47 text

Spring Web MVC

Slide 48

Slide 48 text

Play Framework

Slide 49

Slide 49 text

Benchmark Result 500000 Request Play Framework 140 Spring Web MVC 91 0 20 40 60 80 100 120 140 160 Seconds Time Required to Complete 500000 Request Play Framework 3559 Spring Web MVC 5500 0 1000 2000 3000 4000 5000 6000 Request per Second Request per Second

Slide 50

Slide 50 text

Why Play Slow? • Serialization is blocking process. • Simple serialization is fast, so it’s OK to using blocking process • Heavy serialization is slow, so DON’T use blocking process.

Slide 51

Slide 51 text

How to handle heavy process? • Use Async process and return Future to client • Use Akka for better performance

Slide 52

Slide 52 text

Play Framework with Akka

Slide 53

Slide 53 text

Play Framework with Akka

Slide 54

Slide 54 text

Benchmark Result 500000 Request Play Framework 140 Spring Web MVC 91 Play with Akka 77 0 20 40 60 80 100 120 140 160 Seconds Time Required to Complete 500000 Request Play Framework 3559 Spring Web MVC 5500 Play with Akka 6516 0 1000 2000 3000 4000 5000 6000 7000 Request per Second Request per Second

Slide 55

Slide 55 text

CAN WE MAKE IT FASTER? Play Framework vs Spring Web MVC

Slide 56

Slide 56 text

Play Framework with Jackson

Slide 57

Slide 57 text

Play Framework with Jackson

Slide 58

Slide 58 text

Benchmark Result 500000 Request Play Framework 140 Spring Web MVC 91 Play with Akka 77 Play with Jackson 40 0 20 40 60 80 100 120 140 160 Seconds Time Required to Complete 500000 Request Play Framework 3559 Spring Web MVC 5500 Play with Akka 6516 Play with Jackson 12541 0 2000 4000 6000 8000 10000 12000 14000 Request per Second Request per Second

Slide 59

Slide 59 text

CALL SERVICES ASYNCHRONOUSLY Play Framework vs Spring Web MVC

Slide 60

Slide 60 text

Spring Web MVC

Slide 61

Slide 61 text

Play Framework

Slide 62

Slide 62 text

Spring Web MVC

Slide 63

Slide 63 text

Play Framework

Slide 64

Slide 64 text

Benchmark Result 10000 Request Play Framework 22 Spring Web MVC 53 0 10 20 30 40 50 60 Seconds Time Required to Complete 10000 Request Play Framework 458 Spring Web MVC 189 0 50 100 150 200 250 300 350 400 450 500 Request per Second Request per Second

Slide 65

Slide 65 text

PROJECTS USING PLAY FRAMEWORK Play Framework vs Spring Web MVC

Slide 66

Slide 66 text

Projects using Play Framework • Fraud Detection System 3.0 • Machine Learning • Blibot (Blibli Chat Bot) • X-Hotel

Slide 67

Slide 67 text

THANKS Eko Kurniawan Khannedy Blibli.com