Skip to content

mattofak/restface

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RESTFace

REST content API service prototype.

Provides a consistent & performance-oriented REST API.

Usage

We are leveraging ES6 generators & promises, which means that node 0.11+ is required.

node --harmony restface

You can now benchmark the service with

ab -c10 -n10000 'http://localhost:8888/v1/enwiki/pages/foo/rev/latest/html'

On a single core & with a simple static 'hello world' backend, this currently yields around 7500 req/s. The routing & generator-based handler overhead is very low.

Implementation goals

  • easy to register end point handlers without interfering with other handlers
  • generic monitoring of all backend requests
    • backend perf / issue monitoring
    • know which handler initiated which requests
  • robust even if there are faulty handlers
    • don't crash if there's a syntactical error in a handler
    • blacklist handlers that crashed or timed out often recently (fuse)
    • limit the time a single request can take, properly respond to client
  • optimize for proxying use case
    • make it easy to forward request to backend with minor changes
    • typical handler action is handling 404s, retrying, combining content etc
    • handlers are not expected to perform CPU-intense computations
      • move those to separate services on separate machine / process

Handler interface

Architecture docs

See here.

About

REST API interface proxy prototype

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published