Coder Social home page Coder Social logo

middleman's Introduction

Middleman

Middleman is a reverse proxy which supports regex refreshes and employes memcached as the backend. Middleman was written because varnish didn't work very well for our use case.

  • Varnish employs local RAM hence cannot hold large working sets
  • More Varnish servers means more origin traffic due to cache misses. It adds up.
  • Local cache also create cache coherency problems
  • Varnish monitoring is not at par with what we get from newrelic

Features

  • Middleman employs distributed memory (memcached)
  • Supports regex invalidation
  • Supports url refresh
  • Awesome performance
  • Quickly enable memcached cache on apps without coding

Design Principles

  • As much as possible, do things in background
  • Use memcached to exploit distributed memory

User guide

To run middleman configure middleman webapp in Jetty, Tomcat, Resin, etc. Middleman is configured via a properties file. Specify origin server and memcached nodes in the configuration file. Origin servers is where Middleman will get the content from when it's not found it cache or it needs to refresh a url. Memcached nodes are used for caching.

###Refresh a URL Middleman allows a url to be refreshed on-demand

/_refresh?url=http://app.example.com/index.html

###Invalidate via regex Middleman allows urls to be invalidated by specifying a regex. Middleman maintains a list of regex rules for refreshTimeout period and if the url matches a regex, then it asynchronously refreshes the url when it was being requested.

/_refresh?regex=./posts/tags/code.

Configuration

Middleman is configured via ign/middleman/config/middleman-${environment}.properties under WEB-INF/classes where environment can be specified via System Property environment (Example: /ign/middleman/config/middleman-development.properties). The default value of environment is development.

###middleman-development.properties

#memcached hosts comma separated list of host:port
memecahed=localhost:11211
#memcached cache timeout
#memcachedTimeout=200
memcachedTimeout=604800
#After refresh timeout has expired, the middleman proxy will return the 
# stale data from memcached and schedule a background update
refreshTimeout=120
#refreshTimeout=7200
origin=127.0.0.1:80
#http connect and read timeouts in ms
connectTimeout=5000
readTimeout=30000
#cached rules time out in s
cachedRulesTimeout=5

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.