• This repository has been archived on 08/Mar/2018
  • Stars
    star
    120
  • Rank 287,701 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created over 14 years ago
  • Updated almost 12 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Spawning is a wsgi server which supports multiple processes, multiple threads, green threads, non-blocking HTTP io, and automatic graceful upgrading of code

Spawning is a fast, easy to use, and flexible HTTP server for hosting python web applications which conform to the WSGI interface.

Spawning uses eventlet to do non-blocking I/O for http requests and responses. This means the server will scale to a large number of idle keep-alive connections easily. Spawning can be configured to use multiple OS processes and either POSIX threads or eventlet's green threads, which are implemented using greenlet.

Spawning is open source software, licensed under the MIT license. If you wish to contribute to development, please check out the source from http://github.com/rtyler/Spawning/ and either submit patches or fork spawning and submit a pull request.

Single or Multiple Process

If your wsgi applications store state in memory, Spawning can be configured to run only one Python process. In this configuration your application state will be available to all requests but your application will not be able to take full advantage of multiple processors. Using multiple processes will take advantage of all processors and thus should be used for applications which do not share state.

Single or Multiple Worker Thread

If your wsgi applications perform a certain subset of blocking calls which have been monkeypatched by eventlet to cooperate instead (such as operations in the socket module), you can configure each process to run only a single main thread and cooperate using eventlet's green threads instead. This can be useful if your application needs to scale to a large number of simultaneous open connections, such as a COMET server or an application which uses AJAX polling. However, most existing wsgi applications will probably perform blocking operations (for example, calling database adapter libraries which perform blocking socket operations). Therefore, for most wsgi applications a combination of multiple processes and multiple threads will be ideal.

Graceful Code Reloading

Spawning can watch all Python files that are imported into sys.modules for changes and performs a graceful reload on change. To enable this behavior, specify --reload=dev on the command line. Old processes are told to stop accepting requests and finish any outstanding requests they are servicing, and shutdown. Meanwhile, new processes are started and begin accepting requests and servicing them with the new code. At no point will users of your site see "connection refused" errors because the server is continuously listening during reload.

Running spawning

Spawning can be used to launch a wsgi application from the command line using the "spawn" script, or using Python Paste. To use with paste, specify use = egg:Spawning in the [server:main] section of a paste ini file.

Spawning can also be used to run a Django application by using --factory=spawning.django_factory.config_factory.

Examples of running spawning

Run the wsgi application callable called "my_wsgi_application" inside the my_wsgi_module.py file:

% spawning my_wsgi_module.my_wsgi_application

Run whatever is configured inside of the paste-style configuration file development.ini. Equivalent to using paster serve with an ini file configured to use Spawning as the server:

% spawning --factory=spawning.paste_factory.config_factory development.ini

Run the Django app mysite:

% spawning --factory=spawning.django_factory.config_factory mysite.settings

Run the wsgi application wrapped with some middleware. Pass as many middleware strings as desired after the wsgi application name:

% spawning my_wsgi_module.my_wsgi_application other_wsgi_module.some_wsgi_middleware

Run the wsgi application on port 80, with 4 processes each using a threadpool of size 8:

% sudo spawning --port=80 --processes=4 --threads=8 my_wsgi_module.my_wsgi_application

Use a threadpool of size 0, which indicates that eventlet monkeypatching should be performed and wsgi applications should all be called in the same thread. Useful for writing a comet-style application where a lot of requests are simply waiting on a server-side event or internal network io to complete:

% spawning --processes=4 --threads=0 my_wsgi_module.my_comet_application

Additional Useful Arguments

-l ACCESS_LOG_FILE, --access-log-file=ACCESS_LOG_FILE

The file to log access log lines to. If not given, log to stdout. Pass /dev/null to discard logs.

-c, --coverage

If given, gather coverage data from the running program and make the coverage report available from the /_coverage url. See the figleaf docs for more info: http://darcs.idyll.org/~t/projects/figleaf/doc/

-m MAX_MEMORY, --max-memory=MAX_MEMORY

If given, the maximum amount of memory this instance of Spawning is allowed to use. If all of the processes started by this Spawning controller use more than this amount of memory, send a SIGHUP to the controller to get the children to restart.

-a MAX_AGE, --max-age=MAX_AGE

If given, the maximum amount of time (in seconds) an instance of spawning_child is allowed to run. Once this time limit has expired a SIGHUP will be sent to spawning_controller, causing it to restart all of the child processes.

--status-port=PORT, --status-host=HOST

If given, starts up a small web service to give health status reports on the Spawning server. The service listens on two urls,

The first is an HTML page that displays the status of the server in a human-pleasing manner. The .json url is a JSON formatting of the same data.

The status web service is only started if the --status-port option is supplied and different than the service port. --status-host is useful if monitoring happens on a different ip address than web application requests.

More Repositories

1

vagrant-plugin

An experimental Vagrant plugin for Jenkins
Ruby
104
star
2

otto

Otto is your friendly continuous delivery companion.
Rust
80
star
3

py-yajl

py-yajl provides Python bindings for the Yajl JSON encoder/decoder library
C
74
star
4

tinywm-ada

Port of tinywm to Ada for chuckles
C
61
star
5

blimpy

A Vagrant-inspired tool for managing multiple machines in the cloud
Ruby
61
star
6

zap

A simple cross-platform configuration management and orchestration tool
Rust
48
star
7

cheetah

Cheetah, the Python-powered templating engine
Python
44
star
8

jdp

Jenkins Declarative Parser
Rust
32
star
9

gmrun

Local patches to gmrun to make it compile and run on a modern system
C++
29
star
10

PyECC

Python Elliptical Curve Cryptography module
C
20
star
11

jenkins-selenium-tests

Selenium Tests for the Jenkins CI Server
Ruby
18
star
12

instant-elasticsearch

A little bit of Puppet, and a dash of Vagrant, and BOOM. Elasticsearch cluster
Puppet
14
star
13

xmltojson

A Rust crate for converting XML to JSON
Rust
14
star
14

jpm

The Jenkins Plugin Manager
Ruby
13
star
15

mcabber-utils

Some mcabber utilities I have running around
Python
12
star
16

graphite-tools

Some tools for working with Graphite
Python
12
star
17

ada-playground

Collection of experiments with the Ada language
Ada
11
star
18

opsantipatterns

A collection of mistakes and errors to learn from.
JavaScript
11
star
19

imuse

Experimental (attempted) FUSE filesystem to represent IMAP accounts
C
11
star
20

fastjs

JavaScript FastCGI server based on the v8 engine
JavaScript
11
star
21

Hubboard

A fancy kan ban board for GitHub Issues
JavaScript
11
star
22

proxylet

An Eventlet-based HTTP Proxy
Python
9
star
23

dotdotvote

A simple web application for dot-voting
JavaScript
9
star
24

slide-git-scripts

A collection of the Git scripts that we use here at Slide, Inc.
Python
8
star
25

ironsides

Fork of the SPARK-based DNS server
Ada
8
star
26

memcache-ada

Experimental memcached client implemented in Ada
Ada
8
star
27

ruby-gradle-example

What is wrong with me
Ruby
8
star
28

retrocean

finally bringing modern web design to Jenkins
CSS
8
star
29

presentations

"Source code" for various presentations
Groovy
7
star
30

vim-config

Set of modified dotvimrc and dotvim files used internally in Slide, Inc.
Vim Script
7
star
31

greendns

Monkeypatching green DNS module for Python
Python
7
star
32

IronWatin

IronPython-based utilities for testing via the WatiN framework
Python
7
star
33

connector-django-mysql

Django backend for MySQL Connector/Python, a pure-Python MySQL library
Python
7
star
34

puppet-haproxy

A magical rspec-puppet test-driven module for configuring HAProxy with Puppet
Ruby
7
star
35

brokenco.de

Source code for my blog
HTML
7
star
36

typy

Typy is a pygame-based typing game!
Python
6
star
37

puppet-sauceconnect

Simple Puppet module for managing a Sauce Connect daemon on a host
Ruby
6
star
38

PILServ

Eventlet-based server for applying PIL transformations to images
Python
5
star
39

freebsd-livery

Experimental livery with FreeBSD and pkgng
Shell
5
star
40

fucked-ada

A brainfuck interpreter written in Ada
Ada
5
star
41

puppet-opengrok

Module for managing the OpenGrok source cross referencing tool
Shell
5
star
42

consoleui

Event-driven curses interface library
Python
5
star
43

MicroMVC

Teeny-tiny MVC styled framework for Python and WSGI
Python
5
star
44

redis-ada

Redis client written in Ada
Ada
5
star
45

euler-ada

A number of project euler solutions written in Ada, with an eye towards good software design
Ada
5
star
46

bonnie-as-a-service

so dumb.
Ruby
4
star
47

django-moxy

Moxy is a Django database backend for MySQL using MySQLdb and Eventlet's db_pool
Python
4
star
48

delta-s3-loader

An AWS Lambda for automatically loading JSON files as they're created into Delta tables
Rust
4
star
49

gitplot

Informational plotting about Git with CairoPlot
Python
4
star
50

teambox-tools

Misc. teambox scripts
4
star
51

hiredis-ada

Ada bindings for the hiredis library
Ada
3
star
52

graphy

Fork of graphy, a simple chart library for Python. With 23% less noob.
Python
3
star
53

resin

A simple server to get started with Amber development
Ruby
3
star
54

infra-puppet

Puppet manifests for managing the Jenkins project infrastructure
Puppet
3
star
55

twitterbot

A C#-based Twitterbot for auto-posting RSS items to a twitter account
3
star
56

aci-tunnel

A public tunnel for local services
Shell
3
star
57

synchronik

Rust
3
star
58

jenkins-boxes

A collection of puppeted Jenkins Vagrant base boxes
Ruby
3
star
59

goedesearch

An implementation of Bart de Goede's full-text search engine
Rust
3
star
60

xlib-ada

Xlib bindings for Ada
Ada
3
star
61

puppet-rvm

Simple puppet module for installing per-user RVM
Puppet
3
star
62

TweepyDeck

PyGtk-based Twitter client, aiming to provide TweetDeck-like functionality
Python
3
star
63

tinywm-ruby

An implementation of TinyWM in Ruby with FFI
Ruby
2
star
64

crazy-pipeline-demos

2
star
65

Proggitbot

Simple IRC bot written on top of Mono for ##proggit
C#
2
star
66

ipybot

IronPython-based IRC bot
2
star
67

typedeaf

Another bone-headed idea implemented in Ruby
Ruby
2
star
68

niles

Niles is a touch-friendly Jenkins front-end
JavaScript
2
star
69

launchd-for-freebsd

MOVED!
2
star
70

pyve

Python Virtual Earth client for using Microsoft Virtual Earth web services
Python
2
star
71

ngx_borderpatrol

Edge-authentication
C
2
star
72

nashorn-ruby

Ruby
2
star
73

urlenco.de

Eventlet-based version of Urlenco.de
Python
2
star
74

TweepyDeck.com

Source for the TweepyDeck.com site
JavaScript
2
star
75

dotfiles

Crap from $HOME
Python
2
star
76

Hudson.py

Set of Python classes for working with Hudson's data
Python
2
star
77

debian-ada-vm

A Vagrant VM that provisions Ada packages for you!
Ruby
2
star
78

django_cheetah_example

Simple example for using Cheetah templates with Django
Python
2
star
79

docker-rvm

RVM-based images automatically built by Jenkins
Shell
2
star
80

recipes

1
star
81

blick

A prototype of a monitoring system
Ruby
1
star
82

PmpMyApp

Sample C/Cocoa application for using NAT-PMP
C
1
star
83

XmlToolbar

Silly hack to generate an NSToolbar from some XML
Objective-C
1
star
84

javaone-jruby-demo

Demo scripts for the JavaOne 2014 Script Bowl
Ruby
1
star
85

example-livery

An example livery for blimpy
Shell
1
star
86

erinandtylerswedding.com

Simple wedding site, derpaderp
JavaScript
1
star
87

async-sinatra-test-bug

Reproduction case for this stupid bug
Ruby
1
star
88

rcshub

RCSHub. A bad idea.
Ruby
1
star
89

chucktesta

Ada xUnit experiment for my learnings
Ada
1
star
90

pentagram

Demonstration project for outside-in with operations
Ruby
1
star
91

heroku-sauce

Just an experiment because hey why not
Ruby
1
star
92

sting

Ada-based key-value server that can store every breath you take
Ada
1
star
93

Prunetube

My local network video sharing site
JavaScript
1
star
94

dispersion

An HTTP proxy that slows things down
Ada
1
star
95

odi

Open Distribution Initiative
1
star
96

spawning-db_pool

Reproduction case for a bug with Spawning and eventlet.db_pool
Python
1
star
97

dummy

A stupid dummy project for Hub board testing
1
star
98

httpwizard

Demo application of my ideal web application stack
Groovy
1
star
99

dispatch-ada

Tinkering with libdispatch bindings for Ada
Ada
1
star
100

github-resindrop

GitHub for Amber Smalltalk, packaged as a Resin drop
JavaScript
1
star