Code Monkey home page Code Monkey logo

graphql-mico-poc's Introduction

GraphQL Micro POC

The purpose of this project is to evaluate GraphQL-based services including API gateway with GraphQL remote schema.

There exist the following services each of which just implement an echo API:

An API gateway is also introduced for POC of GraphQL API Gateway.

  • graphql-gateway: A Node.js service using GraphQL remote schema to proxy requests to an above echo API service (Currently I couldn't find any Golang implementation for GraphQL remote schema).
+-------------+   +----------+
|             |   |          |
+ API Gateway +---+ Echo API |
|  (GraphQL)  |   | (GraphQL)|
+-------------+   +----------+

Installation

  • Just install Docker somehow

  • Run one of the echo services (apollo-server/graphq-go/graphq-go-alt):

$ cd apollo-server
$ docker build . -t apollo_server:latest
$ docker run -d -p 3000:3000 --name apollo_server apollo_server:latest
  • Confirm the API:
$ curl -g 'http://localhost:3000/graphql?query={echo(text:"hello"){text}}'
  • Run the API gateway with informing the echo service IP:
$ cd graphql-gateway
$ docker build . -t graphql_gateway:latest
$ SERVICE1_IP=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' apollo_server`
$ docker run -d -p 80:3000 \
--name graphql_gateway \
-e SERVICE1="http://$SERVICE1_IP:3000" \
graphql_gateway:latest
  • Confirm the API Gateway:
$ curl -g 'http://localhost:80/graphql?query={echo(text:"hello"){text}}'

More details are self-explained in each target directory.

Benchmark

The benchmark results are summarized in bench directory. Here we just shows mean Latencies (on 2 GHz Intel Core i5 on MacBook Pro). Note that baseline shows a result for responses without GraphQL operations.

apollo-server                      2.949122ms (baseline: 2.342966ms)
graphql-go                         2.478427ms (baseline: 2.215219ms)
graphql-go-alt                     2.126513ms (baseline: 1.890965ms)
graphql-gateway -> apollo-server   6.241109ms (baseline: 4.466211ms)
graphql-gateway -> graphql-go      5.636672ms (baseline: 4.233277ms)
graphql-gateway -> graphql-go-alt  4.718619ms (baseline: 4.140846ms)

graphql-mico-poc's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.