[ANN] pistachio 0.1.0: HTTP "push" middleware for Rack powered byRedis

T

Tony Arcieri

pistachio is an HTTP long polling middleware for Rack:

https://github.com/tarcieri/pistachio

Need events delivered to an HTTP client in realtime? Perhaps you=92ve
investigated solutions like Comet/Bayeux, BOSH, or WebSockets. Not happy
with those solutions and just want something simple? Pistachio provides a
simple HTTP long polling middleware for Rack. Pistachio provides somewhat
similar functionality to the nginx_http_push_module (
http://pushmodule.slact.net/)

The middleware exposes a very simple HTTP-based protocol for performing lon=
g
polling of Redis's ordered lists:

- HTTP 200 means an item was successfully popped from the list
- HTTP 504 means the long polling request to Redis (in the form of a Redis
BLPOP") timed out and should be retried
- Anything else is an error

Pistachio uses named channels with unique IDs to route messages. Support fo=
r
sessions is not (yet) provided, nor is user-provided dispatching logic.
Instead a client just long polls a particular channel ID, popping any
messages that are available or blocking until a specified timeout if they
aren't. Pubsub support forthcoming...

The path to mount the middleware and the long polling timeout are fully
configurable. And unlike the nginx_http_push_module, you won't need to
recompile nginx to use it.

Pistachio will gain support for distribution and failover following the
release of Redis Cluster. See:
https://github.com/antirez/redis/blob/master/design-documents/REDIS-CLUSTER

Pistachio is built on the Stash library, which provides an abstract
interface to servers like Redis. In theory, it would be possible to use
other servers which provide the same properties as Redis's lists as the
backend, such as the Kestrel message queue. More information on Stash is
available here:

https://github.com/tarcieri/stash

--

SUPER SHORT Q&A!

Q: Does it ROFLSCALE with Fibers and EventMachine?

A: No, Pistachio does not ROFLSCALE. The current implementation is naive an=
d
simple. Pistachio opens a new connection to Redis whenever it services a
request, and that connection is closed whenever the request completes.
Concurrency is provided by threads. This could become a problem if you
expect large numbers of concurrent clients and don't want to run large
numbers of web servers.

Pistachio COULD easily ROFLSCALE using libraries like Rainbows!, async-rack=
,
and em-redis, or even something with Node.js. However, this is irrelevant
until Redis Cluster actually works.

--=20
Tony Arcieri
Medioh! Kudelski
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top