Coder Social home page Coder Social logo

swarm's Introduction

swarm - Fast acceptor pool for Erlang

swarm is a fast and simple TCP and SSL connection acceptor pool library.

Overview

swarm is based loosely on ranch and much credit is due to Loïc Hoguin for basic interface design. The swarm interface resembles ranch's, but under the hood things are a bit different.

In particular, swarm passes transport options straight through, so all options are available, and it provides a more complete transport interface on top of gen_tcp and ssl (e.g. DN parsing for SSL client certs).

The swarm acceptor design is simple, but follows the mochiweb tradition rather than the cowboy/ranch tradition, in that the accepting process becomes the working process, and the listener spawns another acceptor (based on a replacement strategy) to replace it. This design can be tuned to optimize for low-latency burst handling or for one-for-one acceptor replacement. It also removes the need to synchronize over the passing of socket control to a child process.

Motivation

swarm is a key ingredient in middleman, a scalable and modular TCP, SSL, and HTTP reverse proxy. Middleman requires a number of features not provided by ranch, and the simplest path was to build a new acceptor library.

swarm is intended to be fast and simple and to get out of the way, so it is unlikely to receive significant new features.

Using swarm

  • Add swarm as a rebar dependency:
  {swarm, ".*", {git, "https://github.com/jeremey/swarm.git", {branch, "master"}}}
  • Start the application
  swarm:start()
  • Start a listener
  {ok, Pid} = swarm:start_listener(my_app, 100, swarm_tcp, [{port, 8080}], {my_app_handler, handle, []})

swarm's People

Contributors

jeremey avatar

Watchers

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