Showing posts with label memcached. Show all posts
Showing posts with label memcached. Show all posts

2014-04-05

Enabling Markdown on your apache webserver - update 3

Last time on "Enabling Markdown on your apache webserver":
And now, the exciting conclusion....

I've updated my CGI handler yet again with a few new features and I've posted it on my GitHub account, in the docs-on-clearance repo (get 'em cheap while they're all marked down! yuk yuk yuk). The new features are:

1. Included an Apache config snippet that you can just drop into an include directory.

2. The rendered HTML now has a stylesheet! And not just any stylesheet - a cool responsive Bootstrap stylesheet loaded from a CDN! Yes, it's mostly the plain default one with some margins, but it looks a lot better.

3. I enabled table-of-contents links for all header sections so you can have URI fragments that point directly to sections of your document. I consider this unfinished as the fragments are of the form #toc_2 - which isn't very useful. I believe the latest versions of the gem have GitHub style toc fragments, but that's not what is in the ubuntu package repos.

4. I've added support for caching the rendered HTML with memcached. This is more like a nice-to-have, but since we're going to use this full-time for internal documentation at $WORK, I figured I should make the extra effort. Of course, I chose poorly an outdated gem to implement this with, but it's ship now, fix later. Updating to Dalli or something on the ToDo list.

tl;dr - see the docs-on-clearance repo for the code.

As always, I welcome comments, suggestions and pull requests.

2010-11-11

Dumping memcached

I needed to see if memcached was getting the values I thought it was getting. Everyone knows about "stats" to see if it is getting activity, but I looked around and found that it is possible to get some of that data out without knowing how your app stores the data. So I wrote a script to do it:

#!/bin/sh
HOST="localhost"
if [ "$1" != "" ]; then HOST=$1; fi
COUNT=100
if [ "$2" != "" ]; then COUNT=$2; fi
for slab in `echo "stats items" | nc $HOST 11211 | grep :number | cut -d: -f2 -`
do
for item in `echo "stats cachedump $slab $COUNT" | nc $HOST 11211 | grep "^ITEM" | cut -d" " -f2 -`
do
echo "get $item" | nc $HOST 11211
done
done

2008-02-29

An Ode to memcached

When your servers are hurting
And your database needs some relief
Something small, simple and efficient
Can make your response times brief

Sometimes, you don't need anything fancy
You just need something good
My friend is lightweight and speedy
And he does exactly what he should

Keys and values
Hashes and slabs
K.I.S.S.
And viola! it all just works

So go forth, apply caching
And let your servers rest.
Because any sysadmin will tell you,
memcached is the best.

Ratings and Recommendations by outbrain