• Stars
    star
    177
  • Rank 215,985 (Top 5 %)
  • Language
    Ruby
  • License
    MIT License
  • Created almost 16 years ago
  • Updated almost 2 years ago

Reviews

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

Repository Details

A Sinatra rack middleware that presents memcached server stats

Amnesia

Amnesia is what you get when you lose your memory.

Hopefully with Amnesia you'll know exactly whats happening with memory when it comes to memcached.

Amnesia screen shot

Why?

Its always nice to have some statistics to see how everything is performing within your stack. Memcached seems to be a mystery box that people don't really pay a lot of attention to.

Amnesia tells you how your application is performing, when it misses, when it is running sweet, when you're about to run out of memcached and (perhaps) fall down in a screaming heap.

What does it tell you?

All stats are since each memcached instance was restarted

Available as a cumulative result of all your memcached instances, or single instances alone:

  • Cache hits and misses
  • Reads and writes
  • Remaining memory

Available for single instances only:

  • Amount of items stored in cache
  • Connections (current and total)
  • Accesses (Read / Write)
  • Accuracy (Hits / Misses)
  • Memory (Used / Total)

Installation / Getting started

gem install amnesia

How to run it alongside your Rack application

"config.ru":

require 'amnesia'
rack_app = Rack::Builder.app do
  map "/amnesia" do
    run Amnesia::Application.new
  end
  run YourSinatra::Application
end
run rack_app 

How to run it alongside your Rails application

"Gemfile":

gem 'amnesia', '>=1.0.2'

"config/routes.rb":

mount Amnesia::Application.new => "/amnesia" 

Then, cruise on over to your-host.tld/amnesia

Configuration options

Hosts

Amnesia will work automagically if you drop it on a Heroku powered app, likewise—for a "standard" memcache host (running on localhost:11211, the default.).

When you need to specify where your memcache hosts can be found, you can either set an environment variable:

ENV["MEMCACHE_SERVERS"] = ['localhost:11211']

or alternately, you can set it within your config.ru:

use Amnesia::Application, hosts: ["mc1.yourapp.com:11211", "mc2.yourapp.com:11211"]

Authentication

When you want to keep your Amnesia data private, you can set an environment variable that will enable http basic authentication:

ENV["AMNESIA_CREDS"] = ben:schwarz

in your shell, you might do it like this:

export AMNESIA_CREDS=ben:schwarz

on heroku, like this:

heroku config:add AMNESIA_CREDS=ben:schwarz

Potential issues

  • Hosts are listed as "Inactive" or "Not Responding"

Amnesia uses memcached-client to connect to memcached on the standard memcached port (11211), be sure to enter your full hostname with the port if you are using a non standard port. (localhost:11211 will work)

Within my slices, I punched a hole through iptables

sudo iptables -A INPUT -i eth0 -s HOST_THAT_REQUIRES_ACCESS -p tcp --destination-port 11211 -j ACCEPT

You won't need to do this unless you've explicitly blocked ports to your server. (When in doubt, block nearly everything)

Let me know if you come across any issues using Github messaging.

Something missing?

Amnesia used to be a full blown application that required a datamapper sqlite database, yml file for configuration and a bit of pain to get deployed. I decided these were all false constraints and wrapped it up as a middleware instead. Now—You can drop it alongside your rails/sinatra/rack application and see what the hell is going on with Memcached.

Licence

MIT, See LICENCE file.

More Repositories

1

gallery-css

CSS only Gallery
CSS
1,138
star
2

metaquery

A declarative responsive web design syntax. Breakpoints, defined in `<meta>`
JavaScript
324
star
3

passenger-stack

Sprinkles for Apache, Passenger, Memcached, Git, Mysql or Postgres
Ruby
315
star
4

bonsai

A tiny static web site generator
Ruby
296
star
5

currency.io

An offline-capable, html5 currency converter app for the iPhone
JavaScript
296
star
6

sublime-bower

Install Bower packages from within Sublime
Python
228
star
7

developers.whatwg.org

Used to create the contents of developers.whatwg.org
198
star
8

am-grid

Experiemental attribute module grid system
CSS
81
star
9

cache.js

localStorage with timed expiry
JavaScript
55
star
10

smoke

It isn't ready yet
Ruby
47
star
11

bonsai-site

The Bonsai web site source
JavaScript
29
star
12

open-uri-memcached

Ruby's OpenURI with Memcached for caching
Ruby
24
star
13

bom-weather

Weather from the Australian Bureau of Meteorology
Ruby
24
star
14

w3c-spec-styles

An alternate stylesheet for W3C specification pages
JavaScript
23
star
15

heroku-electron-buildpack

Shell
20
star
16

postie

A Sinatra based Rack middleware that provides Australian postcode information via JSON
Ruby
18
star
17

responsive-sass

The source files to a screencast
Ruby
12
star
18

choones

A jQuery plugin to provide monologue style messaging. Inspired by Growl's music video theme.
JavaScript
11
star
19

bower-badges

Show that your project is available in Bower by using a bower badge!
JavaScript
11
star
20

registry

For dirt simple plugin architecture
Ruby
11
star
21

skeet

a heroku ready screen shot application
Ruby
11
star
22

leonardo

A simple ass, half done sparkline graph using Raphael
JavaScript
9
star
23

yahoo-stock

A Yahoo! stocks scraper
Ruby
9
star
24

muxtape-rb

A ruby based gem to download muxtapes
Ruby
9
star
25

grid

A tiny grid system.
Ruby
9
star
26

gifcity

JavaScript
9
star
27

munch

A simple sinatra app to test yahoo pipes to pull down recipes from many web sites
Ruby
9
star
28

transcoder

Transcode from common web based formats into plain old Ruby
Ruby
9
star
29

chrome-request-interception

JavaScript
9
star
30

html5forAuthors

HTML5 (Edition for Web Authors)
JavaScript
8
star
31

rack-smoke

Expose Smoke sources and transcode them into JSON, XML or YAML
Ruby
7
star
32

flickr-rest

A light interface to call flickr 'restful' api methods
Ruby
7
star
33

HTML5.tmbundle

Ruby
7
star
34

flickr-wrapper

A dead project. Here for nostalgia and reference
Ruby
6
star
35

homebrew-sassc

Ruby
6
star
36

Hillegass-Macruby

Cocoa Programming for Mac OS X examples rewritten for MacRuby
Ruby
5
star
37

watch

A simple directory watcher
Ruby
4
star
38

ae

A rack middleware to allow for accessibility on any page.
4
star
39

gitnotify

Enables a post-commit hook to your repositories that sends growl notifications around your local network
Ruby
4
star
40

benschwarz-site-v2

My *new* web site
Ruby
3
star
41

railscamp-13

JavaScript
3
star
42

attr-chain

attr_chain for chainable, single method attribute (get|setters)
Ruby
2
star
43

openuri_recorder

Its like a VCR for the web that you can take on the plane with you
Ruby
2
star
44

benschwarz

2
star
45

smoke-manual

A book about smoke, the ruby dsl
Ruby
2
star
46

html5-workshop-site

The web site from which I'll release details about my HTML5 workshop
JavaScript
1
star
47

dotjs

My ~/.js extensions
JavaScript
1
star