Slide 1

Slide 1 text

REST or GraphQL? A Performance Comparative Study Marcos Nazário @gustavopinto Gustavo Pinto Matheus Seabra

Slide 2

Slide 2 text

? @gustavopinto

Slide 3

Slide 3 text

HTTP @gustavopinto REST

Slide 4

Slide 4 text

@gustavopinto

Slide 5

Slide 5 text

@gustavopinto

Slide 6

Slide 6 text

@gustavopinto

Slide 7

Slide 7 text

@gustavopinto GET https://hacker-news.firebaseio.com/v0/post/8863

Slide 8

Slide 8 text

@gustavopinto GET https://hacker-news.firebaseio.com/v0/post/8863/points

Slide 9

Slide 9 text

@gustavopinto https://hacker-news.firebaseio.com/v0/post/8863/author/ GET https://hacker-news.firebaseio.com/v0/post/8863/author

Slide 10

Slide 10 text

@gustavopinto https://hacker-news.firebaseio.com/v0/post/8863/when/ GET https://hacker-news.firebaseio.com/v0/post/8863/when

Slide 11

Slide 11 text

@gustavopinto https://hacker-news.firebaseio.com/v0/post/8863/flag POST https://hacker-news.firebaseio.com/v0/post/8863/flag

Slide 12

Slide 12 text

@gustavopinto https://hacker-news.firebaseio.com/v0/post/8863/author/hide POST https://hacker-news.firebaseio.com/v0/post/8863/hide

Slide 13

Slide 13 text

@gustavopinto GET https://hacker-news.firebaseio.com/v0/post/8863/comments

Slide 14

Slide 14 text

@gustavopinto GET https://hacker-news.firebaseio.com/v0/post/8863

Slide 15

Slide 15 text

@gustavopinto { "by": "pg", "descendants": 54, "id": 126809, "kids": [ 126822, 126823, 126917, 126993, 126824, 126934, 127072, 127217, 126889, 126875, 127535 ], "score": 47, "time": 1204403652, "title": "Poll: What would happen if News.YC had explicit support for polls?", "type": "poll" "score" : 25, "text" : "or HN: the Next Iteration

I get the impression that with Arc being released a lot of people who never had time for HN before are suddenly dropping in more often. (PG: what are the numbers on this? I'm envisioning a spike.)

Not to say that isn't great, but I'm wary of Diggification.

80% of the stuff that makes the front page is still pretty awesome, but what's in place to keep the signal/noise ratio high? Does the HN model still work as the community scales? What's in store for (++ HN)?", "time" : 1203647620, "title" : "Ask HN: The Arc Effect", "type" : “story" "text" : "Yes, ban them; I'm tired of seeing Valleywag stories on News.YC.", "time" : 1207886576, "type" : "pollopt" "parts": [ 126810, 126811, 126812 ] } GET https://hacker-news.firebaseio.com/v0/post/8863

Slide 16

Slide 16 text

@gustavopinto { "by": "pg", "descendants": 54, "id": 126809, "kids": [ 126822, 126823, 126917, 126993, 126824, 126934, 127072, 127217, 126889, 126875, 127535 ], "score": 47, "time": 1204403652, "title": "Poll: What would happen if News.YC had explicit support for polls?", "type": "poll" "score" : 25, "text" : "or HN: the Next Iteration

I get the impression that with Arc being released a lot of people who never had time for HN before are suddenly dropping in more often. (PG: what are the numbers on this? I'm envisioning a spike.)

Not to say that isn't great, but I'm wary of Diggification.

80% of the stuff that makes the front page is still pretty awesome, but what's in place to keep the signal/noise ratio high? Does the HN model still work as the community scales? What's in store for (++ HN)?", "time" : 1203647620, "title" : "Ask HN: The Arc Effect", "type" : “story" "text" : "Yes, ban them; I'm tired of seeing Valleywag stories on News.YC.", "time" : 1207886576, "type" : "pollopt" "parts": [ 126810, 126811, 126812 ] } GET https://hacker-news.firebaseio.com/v0/post/8863

Slide 17

Slide 17 text

@gustavopinto GET https://hacker-news.firebaseio.com/v0/post/8863 GET https://hacker-news.firebaseio.com/v0/post/8864 GET https://hacker-news.firebaseio.com/v0/post/8865 GET https://hacker-news.firebaseio.com/v0/post/8866

Slide 18

Slide 18 text

@gustavopinto

Slide 19

Slide 19 text

@gustavopinto GraphQL Developed by Facebook Publicly released on 2015

Slide 20

Slide 20 text

@gustavopinto GraphQL Developed by Facebook Publicly released on 2015 GraphQL allows clients to define the structure of the data required, and exactly the same structure of the data is returned from the server, therefore preventing excessively large amounts of data from being returned “ ”

Slide 21

Slide 21 text

@gustavopinto type Query {
 topStories(limit: Int): [Story] }

Slide 22

Slide 22 text

{ "data": { "hn": { "topStories": [ { "title": "Monte Carlo methods Why it's a bad idea to go to the casino" }, { "title": "Public Domain Movies" }, { "title": "Agent 355" } ] } @gustavopinto type Query {
 topStories(limit: Int): [Story] }

Slide 23

Slide 23 text

Research Questions RQ: Which architectural model is the most efficient in terms of performance? @gustavopinto

Slide 24

Slide 24 text

APP1 APP2 APP3 RocketBox TechTeams MyFeed @gustavopinto

Slide 25

Slide 25 text

APP1 APP2 APP3 RocketBox TechTeams MyFeed (Dropbox simplified) (Trello simplified) (Twitter simplified) @gustavopinto

Slide 26

Slide 26 text

APP1 APP2 APP3 Rest Rest Rest RocketBox TechTeams MyFeed (Dropbox simplified) (Trello simplified) (Twitter simplified) @gustavopinto

Slide 27

Slide 27 text

APP1 APP2 APP3 Rest GraphQL Rest GraphQL Rest GraphQL RocketBox TechTeams MyFeed (Dropbox simplified) (Trello simplified) (Twitter simplified) @gustavopinto

Slide 28

Slide 28 text

APP1 APP2 APP3 Rest GraphQL Rest GraphQL Rest GraphQL RocketBox TechTeams MyFeed (Dropbox simplified) (Trello simplified) (Twitter simplified) 350 LoC 270 LoC 471 LoC 388 LoC 171 LoC 265 LoC @gustavopinto

Slide 29

Slide 29 text

APP1 APP2 APP3 Rest GraphQL Rest GraphQL Rest GraphQL RocketBox TechTeams MyFeed (Dropbox simplified) (Trello simplified) (Twitter simplified) 350 LoC 270 LoC 471 LoC 388 LoC 171 LoC 265 LoC JavaScript @gustavopinto

Slide 30

Slide 30 text

network overhead Rest GraphQL Client @gustavopinto

Slide 31

Slide 31 text

GraphQL Client Rest @gustavopinto

Slide 32

Slide 32 text

GraphQL Client Rest GraphQL Client @gustavopinto

Slide 33

Slide 33 text

GraphQL Client Rest GraphQL 1 2 3 100 requests 1000 requests 3000 requests { 15x Client 1, 10, 100 users 1, 500, 1000 users 1, 1000, 3000 users Intel Core i7, 2.20GHz, 8 cores, 16 GB memory, running Ubuntu Linux @gustavopinto

Slide 34

Slide 34 text

Size of the document @gustavopinto

Slide 35

Slide 35 text

Size of the document No reduction @gustavopinto

Slide 36

Slide 36 text

Size of the document No reduction Reduction in 100% of the cases @gustavopinto

Slide 37

Slide 37 text

Size of the document No reduction Reduction in 100% of the cases Reduction in 50% of the cases @gustavopinto

Slide 38

Slide 38 text

Size of the document No reduction Reduction in 100% of the cases Reduction in 50% of the cases @gustavopinto

Slide 39

Slide 39 text

Time per request (ms) @gustavopinto

Slide 40

Slide 40 text

Time per request (ms) @gustavopinto

Slide 41

Slide 41 text

Time per request (ms) @gustavopinto

Slide 42

Slide 42 text

Time per request (ms) @gustavopinto

Slide 43

Slide 43 text

Time per request (ms) @gustavopinto

Slide 44

Slide 44 text

No content