GithubHelp home page GithubHelp logo

pooling-web-server's Introduction

A simple pooling webserver
==========================

Features:
---------
 * Pooling using java.util.concurrent.Executor
 * Static file serving
 * Http Keep-alive handling
 * Experimental implementation using pooling and nio

Architecture:
-------------
This contains two implementations of a pooling webserver:

SimplePooledWebServer:
The main thread waits and accepts connections and then schedules processing of
the connection with the executor. If keep-alive is enabled the thread keeps waiting
for requests for a certain time.

NioPooledWebServer:
NioPooledWebServer is an experimental implementation, which uses java.nio to manage the currently idle
keep-alive connections along with new connections in the main thread. See the source code for more explanation
how this works.

Classes:
--------
SimplePooledWebServer - The main class accepting connections and scheduling processing of requests
Settings - Global configuration
Handler - An abstraction of a component handling incoming requests in their own thread.
HttpHandler - An abstract handler doing basic Http Request/Response handling
StaticHttpFileHandler - A HttpHandler serving static files from the file-system
PingHandler - An example handler echoing requests directly back to the client

NioPooledWebServer - A more sophisticated web server using both pools and java.nio to 
                     manage keep-alive connections in the main thread.

Notes:
------

This is a proof of concept of a pooling web server. The real work is finding out the best settings
for pooling and timeouts. 

In a productive environment you would probably use existing solutions for pooling and socket handling. E.g.
the Jetty webserver or Apache MINA.

Run
---
With Maven installed, use `mvn exec:java` to run the simple webserver. Edit the pom.xml if you want to run the
Nio-version.

pooling-web-server's People

Contributors

jrudolph avatar

Stargazers

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