Giter VIP home page Giter VIP logo

wesgi's Introduction

wesgi implements an ESI Processor as a WSGI middeware. It is primarily aimed at development environments to simulate the production ESI Processor. Under certain conditions it may be used in production as well.

Completeness

This implementation currently only implements <esi:include> and <!--esi --> comments. The relevant specifications and documents are:

Performance

An ESI processor generally makes a lot of network calls to other services in the process of putting together a page. So, in general, to reach very high levels of performance it should be asynchronous. Standard Python and WSGI is synchronous, placing an upper limit on performance which depends on the following:

  • How many threads are used
  • How many ESI includes used per page
  • The speed of the servers serving the ESI Includes
  • Whether wesgi uses a cache and if the ESI includes come with Cache-Control headers

Depending on the situation, wesgi may be performant enough for you.

There are also a number of ways to run WSGI applications asynchronously, with varying definitions of "asynchronous".

Usage

>>> from wesgi import MiddleWare
>>> from wsgiref.simple_server import demo_app

To use it in it's default configuration for a development server:

>>> app = MiddleWare(demo_app)

To simulate an Akamai Production environment:

>>> app = MiddleWare(demo_app, policy='akamai')

To simulate an Akamai Production environment with "chase redirect" turned on:

>>> from wesgi import AkamaiPolicy
>>> policy = AkamaiPolicy()
>>> policy.chase_redirect = True
>>> app = MiddleWare(demo_app, policy=policy)

If you wish to use it for a production server, it's advisable to turn debug mode off and enable some kind of cache:

>>> from wesgi import LRUCache
>>> from wesgi import Policy
>>> policy.cache = LRUCache()
>>> app = MiddleWare(demo_app, debug=False, policy=policy)

The LRUCache is a memory based cache using an approximation of the LRU algorithm. The good parts of it were inspired by Raymond Hettinger's lru_cache recipe.

Other available caches that can be easily integrated are httplib2's FileCache or memcache. See the httplib2 documentation for details.

Development

Development on wesgi is centered around this github branch:

https://github.com/jinty/wesgi

wesgi's People

Contributors

ollyc avatar

Stargazers

Keryn Knight avatar Jeff Triplett avatar Alan Justino da Silva avatar Brian Sutherland avatar Seán Stickle avatar

Watchers

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