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

Death, Taxes, and HTTP (Chicago Roboto 2017 Key...

Death, Taxes, and HTTP (Chicago Roboto 2017 Keynote)

‘Tis impossible to be sure of anything but death, taxes, and HTTP. This talk will explore some of the overhead inherent to HTTP and how it can be optimized or eliminated for more efficient networking.

Video: https://youtu.be/6uroXz5l7Gk?t=357

Jake Wharton

April 20, 2017
Tweet

More Decks by Jake Wharton

Other Decks in Programming

Transcript

  1. You

  2. RTT TLS v1.3 w/ 0-RTT session resumption TLS v1.3 w/

    session resumption TLS v1.3 TLS v1.2 w/ session resumption TLS v1.2 2 1 1 1 0
  3. OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder()

    .url("https://twitter.com") .build(); Call call = client.newCall(request); Response response = call.execute(); System.out.println(response.handshake().tlsVersion());
  4. OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder()

    .url("https://twitter.com") .build(); Call call = client.newCall(request); Response response = call.execute(); System.out.println(response.handshake().tlsVersion());
  5. OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder()

    .url("https://twitter.com") .build(); Call call = client.newCall(request); Response response = call.execute(); System.out.println(response.handshake().tlsVersion()); TLS_1_2
  6. GET /YHTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic

    QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"} HTTP
  7. .js .html .js .js .js .js .js .js .png .png

    .png .png .png .png .png .png .css .css .css .css
  8. .js .html .js .js .js .js .js .js .png .jpg

    .png .png .jpg .png .png .png .png .png .css .css .css .css
  9. .js .html .js .js .js .js .js .js .png .jpg

    .png .png .jpg .png .png .png .png .png .css .css .css .css 22 requests
  10. .js .html .js .js .js .js .js .js .png .jpg

    .png .png .jpg .png .png .png .png .png .css .css .css .css 16 requests
  11. .js .html .png .jpg .png .png .jpg .png .png .png

    .png .png .css .css .css .css 13 requests
  12. .js .html .png .jpg .png .png .jpg .png .css 6

    requests .png .png .png .png
  13. .js .html .png .jpg .png .png .jpg .png .css 6

    requests .png .png .png .png
  14. /api/payments [A 1234, 1275, 1690, 2641, 2903, 4991, 5312, 5319,

    14328, 28321, 29948, 30991, 37174, 73572 ]B
  15. /api/payments [A 1234, 1275, 1690, 2641, 2903, 4991, 5312, 5319,

    14328, 28321, 29948, 30991, 37174, 73572 ]B /api/payments/{id} {C id: 1234, amount: 4200, currency: "USD", initiator_id:F48818374, recipient_id:G24567654, initiated_at: 14764993868, completed_at: 14769455213 },Z
  16. /api/payments [A {C id: 1234, amount: 4200, currency: "USD", initiator:F{

    id: 48818374, name: "Jake Wharton" }, recipient:G{ id: 24567654, name: "Jesse Wilson" }, initiated_at: 14764993868, completed_at: 14769455213 },Z ... /api/payments/{id} 1234 1275 1690, 2641, 2903, 4991, 5312, 5319, 14328,
  17. GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"} HTTP/1.1 HTTP/2 GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"}
  18. GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"} HTTP/1.1 HTTP/2 GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"}
  19. GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"}
  20. GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"}
  21. GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"} ID: 2 ID: 2
  22. GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"} ID: 2 ID: 2 GET /api/payments HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4
  23. GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"} ID: 2 ID: 2 GET /api/payments HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4
  24. GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"} ID: 2 ID: 2 GET /api/payments HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4
  25. GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"} ID: 2 ID: 2
  26. GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 {"id":1234,"amount":4200,"currency":"USD"} ID: 2
  27. GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2
  28. GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 {"id":1234,"amount":420 ID: 2 [1234,1275,1690,2641,2903,49 ID: 4
  29. GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2
  30. GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4
  31. GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4
  32. GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4
  33. GET / HTTP/1.1 0x25: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4
  34. GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 Accept: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4
  35. GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json Authorization:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4
  36. GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4
  37. GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4
  38. GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4
  39. GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4
  40. GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16:

    Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4
  41. Client Server GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12:

    application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 2 HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 ID: 4
  42. Client Server GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12:

    application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 2 HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 ID: 4
  43. Client Server HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21:

    "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 HTTP/1.1 200 OK 0x1E: application/json 0x1B: 471 0x21: "ae7284b30ccc93" 0x2B: Wed, 19 Apr 2017 09:22:09 GMT ID: 4
  44. Client Server HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21:

    "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 HTTP/1.1 200 OK 0x1E: application/json 0x1B: 471 0x21: "ae7284b30ccc93" 0x2B: Wed, 19 Apr 2017 09:22:09 GMT ID: 4
  45. Client Server 0x08 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B:

    Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 0x08 0x1E: application/json 0x1B: 471 0x21: "ae7284b30ccc93" 0x2B: Wed, 19 Apr 2017 09:22:09 GMT ID: 4
  46. Client Server 0x08 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B:

    Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 0x08 0x1E: 0x1A 0x1B: 471 0x21: "ae7284b30ccc93" 0x2B: Wed, 19 Apr 2017 09:22:09 GMT ID: 4
  47. Client Server 0x08 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B:

    Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 0x08 0x1E: 0x1A 0x1B: 471 0x21: "ae7284b30ccc93" 0x2B: Wed, 19 Apr 2017 09:22:09 GMT ID: 4
  48. Client Server ID: 2 GET / HTTP/1.1 0x25: square.com:443 0x39:

    okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 2 0x08 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 4 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 ID: 4 0x08 0x1E: 0x1A 0x1B: 471 0x21: "ae7284b30ccc93" 0x2B: Wed, 19 Apr 2017 09:22:09 GMT
  49. OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder()

    .url("https://twitter.com") .build(); Call call = client.newCall(request); Response response = call.execute(); System.out.println(response.protocol());
  50. OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder()

    .url("https://twitter.com") .build(); Call call = client.newCall(request); Response response = call.execute(); System.out.println(response.protocol());
  51. OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder()

    .url("https://twitter.com") .build(); Call call = client.newCall(request); Response response = call.execute(); System.out.println(response.protocol()); h2
  52. {"id":1234,"amount":4200,"currency":"USD"} JSON message Payment { string id = 1; int32

    amount = 2; Currency currency = 3; } enum Currency { USD = 1; } Protocol Buffers
  53. {"id":1234,"amount":4200,"currency":"USD"} JSON message Payment { string id = 1; int32

    amount = 2; Currency currency = 3; } enum Currency { USD = 1; } Protocol Buffers 1=1234 2=4200 3=1
  54. {"id":1234,"amount":4200,"currency":"USD"} JSON message Payment { string id = 1; int32

    amount = 2; Currency currency = 3; } enum Currency { USD = 1; } Protocol Buffers 1=1234 2=4200 3=1 0104D20210680301
  55. {"id":1234,"amount":4200,"currency":"USD"} JSON message Payment { string id = 1; int32

    amount = 2; Currency currency = 3; } enum Currency { USD = 1; } Protocol Buffers