Posts Tagged ‘drb’

Distribunaut

Sunday, April 5th, 2009

Hey there everyone, it certainly has been awhile, a month by my count. I have been diligently working on a book for Addison-Wesley called, “Distributed Programming with Ruby”, so having the time to blog went from a luxury to almost non-existent. But here’s another little post to keep your RSS feeds happy.

I’ve started working on porting the mack-distributed package to the non-Mack world. This new project, and I use the term new loosely for the time being, is tentatively called Distribunaut. The project on GitHub can be found here: http://github.com/markbates/distribunaut/tree/master. It’s pretty rough right now. I’ve ported over the distributed objects section of mack-distributed, but not the views and routes.

You can install the gem like such:

$ gem sources -a http://gems.github.com
$ sudo gem install markbates-distribunaut

To use Distribunaut we first need to start a Rinda::RingServer. Distribunaut comes with a binary to help make this easier:

$ distribunaut_ring_server start

Once we’ve done that we can create an object we would like to share:

When we run that we can access it like such:

That would result in the following being printed out by our ‘client’ code:

On our ‘server’ side we would see something like this:

This is, clearly, a very simple example, but it shows you how easy it is to use Distribunaut. We haven’t done any real configuration, and things just magically work!

Over the next couple of months I’ll be extending and rebuilding this library to make it even more powerful and easy to use. I’m going to add fault tolerance, selection algorithms, and whole lot more. The API you see in these examples will most likely remain unchanged, but I’m planning on pretty big under the cover changes.There will be a very in-depth look into all of this in the book, obviously. (Shameless plug, I know.)

If anybody out there wants to contribute to this project, I’d love the help. Any sort of feedback is welcome.

Mack @ RubyConf ’08

Thursday, September 11th, 2008

Mark your calendars, on Day One, from 1.15PM – 2.00PM, in Room 2, I’ll be delivering a presentation on building distributed applications.

http://www.rubyconf.org/talks/15

Building multiple applications that all need to share data and other information between can be a daunting and challenging task. Mark will help to demystify the use of Ruby systems such as Rinda and DRb and show you how they can be used to link applications together. Through the development of the Mack framework and its use in building Helium.com, Mark will share the highlights and the pitfalls of distributed application development.

Make sure and sign up for the conference today, as attendance is limited to only 500.

Cachetastic 1.7.0 Release

Wednesday, June 4th, 2008

The simple, yet extremely powerful, Ruby caching framework, Cachetastic has been upgraded to 1.7.0. The big new feature of this release is the Cachetastic::Cacheable module. Including this module allows any class to become a Cache.

class Person
include Cachetastic::Cacheable
end
Person.set_into_cache(:hi, "Hello There")
Person.get_from_cache(:hi) #=> "Hello There"

Under the covers this creates a Cachetastic::Caches::Base object and proxies requests to it. This is a very simple example and belies the richness of the Cachetastic library. 

http://cachetastic-api.mackframework.com/

Features:

  • Flexible configuration. All caches have can either have their own configurations, or they can inherit from a default configuration.
  • Easy to use Adapter API. Included adapters include, LocalMemory, Memcache, DRb, File, and more. With the Adapter API being so simple, it’s easy to build your own custom adapter.
  • Flexible logging. Each cache can have it’s own loggers, or they can use the default logger.
  • JIT caching. Through Ruby’s powerful block structure, you can pass a block to a ‘get’ call and have it run if the results from the get are either ‘nil’ or ‘empty’
  • Cachetastic::Cacheable module turns any Object into a cache. It allows for any instance of that Object to cache and uncache itself.
  • And much more!

Release 0.4.5

Monday, April 14th, 2008

Well, here it is! The release you all were waiting for, the one that finally gives migration support to Mack! That’s right, now whether you use ActiveRecord or DataMapper, you can use the familiar rake task ‘db:migrate’ to run your migrations. Yippie! The scaffold generator will also generate a migration for you, assuming you have ORM support enabled.

There’s still some work to go on this, like the ability to pass in command line args to the task to build the full migration for you, but it’s a start! It’s now pretty easy to get your app going.

Also in this release is a rewrite of the distributed routing functionality. It’s now been rewritten to use Rinda. This is going to be the standard for all the distributed functionality that will be coming Mack over the next couple of months. As more functionality lke this is developed, the more it will be wrapped in nice, easy to use APIs.

There’s also been some tidying up here in there in the code tree. For example, new applications don’t get generated with a boot.rb file. Looking at it, there’s really no need for it, since everything is done with Rake tasks.

Overall, I’m very happy with the release, and I feel that this release definitely makes Mack a VERY useable framework because of the migration support. Enjoy!

Changelog:

  • Removed boot.rb file. It was unnecessary.
  • When a new Mack application is generated the Rakefile that gets generated is stamped with the Mack gem version used to create it. This ties the project to that gem. This can, of course, be upgraded as new Mack gems come out, but it’s a good way of tying your app to a specific revision of Mack.
  • Added support for migrations for both ActiveRecord and DataMapper. DataMapper migration support requires DataMapper 0.3.0 gem. Please keep in mind, though, that DataMapper 0.3.0 has a serious bug in it, which may prevent you from using it. Please see http://www.mackframework.com/2008/04/09/horrible-bug-in-datamapper-030/ for more information.
  • Rewrote distributed routing support to use Rinda inside of plain old DRb. This makes for an almost zero configuration usage.
  • Added: mack_ring_server binary to start a Rinda ring server for use with distributed routing.
  • Sqlite3 is now the default database for Mack applications configured with ORM support.
  • Added a test helper method, rake_task, to aid in the testing of Rake tasks.
  • Added: rake generate:migration name=<migration_name>
  • Added: rake db:migrate
  • Added: rake db:abort_if_pending_migrations
  • Added: rake db:rollback
  • Added: rake db:version
  • Added: rake mack:ring_server:start
  • Added: rake mack:ring_server:stop
  • Added: rake mack:ring_server:restart
  • Added: rake mack:ring_server:services:list
  • gem: application_configuration 1.2.2
  • gem: daemons 1.0.10