Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Play Framework vs Spring Web MVC

Play Framework vs Spring Web MVC

Play Framework vs Spring Web MVC

Eko Kurniawan Khannedy

May 24, 2016
Tweet

More Decks by Eko Kurniawan Khannedy

Other Decks in Technology

Transcript

  1. Spring Web MVC • Spring Boot • Spring Web MVC

    • Java 8 • Apache Tomcat • Thymeleaf
  2. Benchmark Scenario • Hello $name • Hello $name as JSON

    • Hello $name as HTML • 2 Seconds Blocking Process • Atomic Increment • Big JSON • Call Services Asynchronously
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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.
  17. How to handle heavy process? • Use Async process and

    return Future to client • Use Akka for better performance
  18. 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
  19. 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
  20. 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
  21. Projects using Play Framework • Fraud Detection System 3.0 •

    Machine Learning • Blibot (Blibli Chat Bot) • X-Hotel