If Google Analytics (formerly Urchin) has become one of the most popular tracking systems, it fails at being live because of its architecture. You only get valid data the day after which is the default view anyways. I tried to make something to improve the actual solution we are using at work.
What we do have at work is a basic session counter. It helps us not pushing a release when a lot of people are surfing the website even it has been easier since we switched from Mongrel to Passenger. From a simple number, like “280 sessions” I’d try to move that to the next level and having a view of the actual usage.
The idea is to count views and to store that into memcached using the current time as a key and putting a timeout of the length of the needed graph.
# first visit memcache.add(now, 1, 3600) # next visits memcache.incr(now)
And to build the graph, you get all the values from a set of keys at once and then use Google Chart is used to build a nifty view.
Stats of the last hour charted by Google Chart.
This is a Rack (or a WSGI) middleware so can fit into your application very easily. Get the source code that contains an example: