Skip to content

An example GraphQL server with result size calculation to be used for experiments.

License

Notifications You must be signed in to change notification settings

LiUGraphQL/graphql-result-size-experiment

Repository files navigation

Example GraphQL Server

This repo contains everything related to the concrete SQLite-based GraphQL implementation with result size calculation that Andreas Lundquist has used for his experiments, as documented in his Master's thesis titled Combining Result Size Estimation and Query Execution for the GraphQL Query Language.

Note: If you are here to find the implementation that Tim Andersson has used for his Bachelor thesis (Result size calculation for Facebook's GraphQL query language), switch to the TimAndersson branch.

The GraphQL server is implemented using apollo-server-express and it provides access via SQLite to the relational database representation of a BSBM dataset. This database is available in the file database.db. The server uses an additional package to calculate the size of query response objects, which is available at github: LiUGraphQL/graphql-result-size. Moreover, the server uses i) an extended version of graphql-extensions, ii) an extended version of apollo-tracing-js, and iii) an extended version of apollo-server-core.

Deployment

git clone
cd graphql-result-size-experiment
npm ci

Note that the test server needs to be deployed with npm ci rather than npm install. This is necessary to make sure that the deployment uses the package versions specified in package-lock.json (namely, our extended version of graphql-extensions, our extended version of apollo-tracing-js, and our extended version of apollo-server-core).

The server is started with

node server.js

Starting the server will host a GraphQL http endpoint on http://localhost:4000/graphql, and a GraphiQL interface on http://localhost:4000/graphiql.

Running the experiments

After starting the server in one terminal, the experiment can be run from a client-side perspective by executing commands such as the following in another terminal.

npm test -- -i 1 -q 1

This particular command will execute test query 1 for 1 iterations, and the test results will be written into the file output.txt. The test queries are available in the file test/queries.js.

About

An example GraphQL server with result size calculation to be used for experiments.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published