Global Hash?


#1

I am working on a remote control slideshow app. Basically, there is a
control URL, and viewers point at a different URL to see the slides.
When the controller changes the slide, all viewers are updated.

The viewer contains an ajax periodic updater which loads javascript to
change some img src’s.

Multiple shows can be run at once. I might be watching show ‘foo’ at
www.slideshow.com/foo/ while you’re watching show ‘baz’ at
www.slideshow.com/baz/.

In order to maintain the current state of a given show, I need to store
the value of the current slide for that show. I’m imagining a hash with
showname, currentslide pairs. When I start a new ‘foo’ show, a new hash
is created with a ‘foo’ -> 1 pair (at the start of a show, the slide is
no. 1 by default).

There are an average of 50 simultaneous viewers, each refreshing every 2
seconds.

Questions:

  • Should my currentslide info be stored in aDB? Seems like a big hammer
    for a small problem.

  • No one seems to like global variables. But would they work here?

  • I’m trying to keep this in RAM for performance. It looks like
    Madeleine will work for this, but is that overkill, too? For a 100 slide
    show, I’d have 100 snapshots. If I ran that show 100 times, I’d have
    10,000 snapshots. The API page for Madeleine is down, as is Pervayer’s
    page. Are there commands to purge stale or unneeded snapshots?

  • All I really need is a simple hash kept in RAM, accessible across
    multiple HTTP invocations. Suggestions?


#2
  • All I really need is a simple hash kept in RAM, accessible across
    multiple HTTP invocations. Suggestions?

http://www.danga.com/memcached/