New-age Transactional Systems - Not Your Grandpa's OLTP
John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.
The content has been bookmarked!
There was an error bookmarking this content! Please retry.
Posted by Mirko Stocker on Apr 02, 2008
Rack provides an interface between webservers and Ruby web-frameworks. This relieves the framework creators from the burden of writing a handler for each specific webserver and thus removes a lot of duplicated effort.
Working with Rack is really easy. The following example is all you need to create a minimal application handler that runs with Mongrel:
require 'rack'The
app = lambda { |env| [200, {"Content-Type" => "text/plain"}, ['Hello World!']] }
Rack::Handler::Mongrel.run(app, :Port => 3000)
env argument contains a hash of environment variables and request parameters. The return value of the block consists of an array with three elements: the HTTP status code, the header and the body of the response.
Christian Neukirchen, the creator of Rack, shared some information about the history of Rack with InfoQ:
In the beginning, I was dissatisfied with the state of web frameworks in Ruby, and threw around a few ideas on writing my own. Along that line, web.py was released, and I liked how small and easy they kept it. So I started writing the framework but I got nowhere, because I was side tracked writing the usual stuff like Cookie parsing and so on. I actually copied a few bits of code from other projects, but it was still pretty boring work that just had to be done. That framework never got far.
Later, I learned about Python's Nevow, and wanted to implement something akin to it, but as soon as I started, I noticed I kept rewriting all these helpers and adapters for different servers. Learning more about Python frameworks, I stumbled upon WSGI, read, liked, simplified, and finally drafted Rack. I reassembled the code I already had written, modularized it based on the structure of Python Paste, and soon Rack 0.1 was ready.
When Rack was usable, I still didn't have a framework I liked, so I implemented Coset, which is what I use these days. It draws inspiration from Camping, web.py and RESTlet.
There's already quite an impressive list of frameworks with support for Rack:
* Camping (included in the Rack distribution)
* Coset
* Halcyon
* Maveric
* Merb
* Mack
* Racktools::SimpleApplication
* Ramaze
* Rails (third party, delivered with thin)
* Sinatra
* Vintage
Rack can also be used collaboratively with a framework. So for example, if one just needs simple and fast processing for certain requests, Rack's Rack::Cascade can be used to cascade several applications. This blog post by Ezra Zygmuntowicz explains how to use Rack for file uploads without going through the full merb stack.
For the future, Christian plans to stabilize the specification for a 1.0 release.
To learn more about Rack, visit the official Rack website. For more in-depth information, there's a paper from Euruko 07 about the inner workings of Rack.
A Guide to Branching and Merging Patterns
Modeling Your Cloud Services Brokerage
Complimentary Gartner (Hype Cycle for Cloud Security) Report
Using Drools? See what you're missing! Get the Power of Drools with the Assurance of Red Hat
FWIW; I'm a long time python programmer that never fully grokked WSGI and Paste. Some how Rack's simplest application example sparked an "aha!" that just wasn't there before. I'll have to revisit the python contingent to see what I overlooked.
One question..can you pass an IO object back for the response body?
One question..can you pass an IO object back for the response body?
I've just tried it and yes, it seems to work :)
John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.
Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.
Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.
Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).
Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.
Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.
One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.
InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.
2 comments
Watch Thread Reply