Giter VIP home page Giter VIP logo

tokamak's Introduction

Jacquard/Tokamak

  • A small and fast library for doing sockets in node.js

Build

npm run build

Install

npm install jacquard

Documentation

[TODO]

Testing

npm install --dev-only
npm run test

Features

Available

  • small fast tcp and http library for node.js
  • zero heap allocations under load
  • low latency
  • built in cluster mode for child workers
  • built in tcp proxy for minimal copy socket proxying
  • Unix Domain Sockets/Pipes
  • TCP
  • HTTP Pipelined requests

Planned/To Decide

  • SSL wrapper for socket
  • Low overheader router for api developers
  • Node.js/Express/Connect middleware compatibility
  • HTTP/2 support
  • Websocket support
  • "ws" module compatibility layer
  • API Gateway with Plugins
  • Metrics
  • Tracing

Goals

  • to be small, fast and low latency
  • to be robust and safe under load/attack
  • to be able to serve as many API requests as nginx with lua
  • to be near top of techempower json and plaintext benchmarks
  • to be able to handle load of a busy API gateway when proxying to backends
  • to do everything kong can but better/faster and native to JS
  • to be easy to develop plugins and middlewares for

API

Socket

Methods

  • Socket.listen
  • Socket.connect
  • Socket.bind
  • Socket.close
  • Socket.pull
  • Socket.push
  • Socket.write
  • Socket.writeText
  • Socket.setup
  • Socket.setNoDelay
  • Socket.pause
  • Socket.resume
  • Socket.setKeepAlive
  • Socket.proxy
  • Socket.remoteAddress

Events

  • Socket.onConnect
  • Socket.onHeaders
  • Socket.onBody
  • Socket.onRequest
  • Socket.onResponse
  • Socket.onClose
  • Socket.onWrite
  • Socket.onData
  • Socket.onError

Benchmarks

Normal (Non-Pipelined) HTTP

node examples/fast
docker run -it --rm williamyeh/wrk -c 200 -t 2 -d 20 http://172.17.0.1:3000/
  • 175k RPS on single Core i7
  • 36 MB RSS with no gc pauses as no new garbage created
  • Avg Latency 1.14ms, Max Latency 9.04ms
  • CPU pegged at 100%

Normal (Non-Pipelined) HTTP

node examples/fast
docker run -it -v $(pwd):/foo --rm williamyeh/wrk -s /foo/bench.lua -c 2000 -t 2 -d 20 http://172.17.0.1:3000/
  • 552k RPS on single Core i7
  • 100 MB RSS with no gc pauses as no new garbage created
  • Avg Latency 25.19ms, Max Latency 327ms
  • CPU pegged at 100%

tokamak's People

Contributors

billywhizz avatar

Stargazers

Brian Christie avatar

Watchers

 avatar James Cloos 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.