From d158dc679a3bc16849361642ed8664b28bb6fd3e Mon Sep 17 00:00:00 2001 From: Junwei Zhao Date: Mon, 5 Mar 2018 17:26:39 +1100 Subject: [PATCH] Add JSON-RPC --- categories/application.md | 95 ++++++++++++++++++++++++----------- categories/software-design.md | 2 +- 2 files changed, 67 insertions(+), 30 deletions(-) diff --git a/categories/application.md b/categories/application.md index 4ca8537..9bde5f5 100644 --- a/categories/application.md +++ b/categories/application.md @@ -5,62 +5,99 @@ - Kibana # APM -- Newrelic -- Pinpoint +## Newrelic + +The famous APM service provider, it support multiple languages, it requires you install agent to the application. +## Datadog + +Another alternative APM service provider +## Pinpoint + +The Java based open source APM. + +# Ping check service + +## Pingdom +It's a online web services, it gives you ability to do ping to your website from different regions, web servers. # Monitor -- Bosun +- Bosun - Prometheus # API -- RPC(remote procedure call) +## RPC(remote procedure call) - disadvantages - coupling - clients needs to know the request procedure names - advantages - more freedoms to define any requests. - - examples - [https://api.slack.com/methods](https://api.slack.com/methods) + - examples: -- Restful /Representational State Transfer +## Restful /Representational State Transfer - Easy to cache - every url represent a resource - - disadvantages - - some special method is hard to use restful to name it. like /login, /resetpassword - - examples - - [https://developer.github.com/v3/](https://developer.github.com/v3/) + - disadvantages some special method is hard to use restful to name it. like /login, /resetpassword + - examples [https://developer.github.com/v3/](https://developer.github.com/v3/) - methods - GET - POST - - PUT - DELETE + - PUT + - DELETE -- GraphQL - Can define fields you want +## GraphQL -- gRPC + It Can allows you to define fields you want to have. + +## gRPC - protocol buffers - ```go - // The greeter service definition. - service Greeter { - // Sends a greeting - rpc SayHello (HelloRequest) returns (HelloReply) {} - } - // The request message containing the user's name. - message HelloRequest { - string name = 1; - } - // The response message containing the greetings - message HelloReply { - string message = 1; - } - ``` + +```go + // The greeter service definition. + service Greeter { + // Sends a greeting + rpc SayHello (HelloRequest) returns (HelloReply) {} + } + // The request message containing the user's name. + message HelloRequest { + string name = 1; + } + // The response message containing the greetings + message HelloReply { + string message = 1; + } +``` - A opensource remote procedure call framework based on HTTP2 and protobuf - advantages - baed on HTTP2, better performance - call remote like local method, and support multiple language - protobuf serialization and deserialization is faster than JSON +## JSON-RPC + +It's a little bit similar with gRPC one, but you define the action method in the JSON request body. + +POST /api +```json +{ + "jsonrpc": "2.0", + "method": "subtract", + "params": [42, 23], + "id": 1 +} +``` +Links: +* JSON-RPC specification: +* O API - an alternative to REST APIs +: # Log and Error -- Sentry +## Sentry + +Within Sentry, you can view all your errors, and also do filtering and grouping things. + +## ELK + +Elasticsearch + Logstash + Kibana diff --git a/categories/software-design.md b/categories/software-design.md index 3c3db66..3acdbe0 100644 --- a/categories/software-design.md +++ b/categories/software-design.md @@ -91,7 +91,7 @@ In his book "Object Oriented Software Construction," Betrand Meyer introduced th - [https://github.com/iluwatar/java-design-patterns](https://github.com/iluwatar/java-design-patterns) -# some tips +# Some tips - concurrency vs parallelism